Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of non-existent Vector3.Axis enum type in built-in methods and members #99341

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/math/geometry_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ Vector<Plane> Geometry3D::build_box_planes(const Vector3 &p_extents) {
return planes;
}

Vector<Plane> Geometry3D::build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, Vector3::Axis p_axis) {
Vector<Plane> Geometry3D::build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, int p_axis) {
ERR_FAIL_INDEX_V(p_axis, 3, Vector<Plane>());

Vector<Plane> planes;
Expand Down Expand Up @@ -793,7 +793,7 @@ Vector<Plane> Geometry3D::build_sphere_planes(real_t p_radius, int p_lats, int p
return planes;
}

Vector<Plane> Geometry3D::build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis) {
Vector<Plane> Geometry3D::build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, int p_axis) {
ERR_FAIL_INDEX_V(p_axis, 3, Vector<Plane>());

Vector<Plane> planes;
Expand Down
4 changes: 2 additions & 2 deletions core/math/geometry_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ class Geometry3D {
static MeshData build_convex_mesh(const Vector<Plane> &p_planes);
static Vector<Plane> build_sphere_planes(real_t p_radius, int p_lats, int p_lons, Vector3::Axis p_axis = Vector3::AXIS_Z);
static Vector<Plane> build_box_planes(const Vector3 &p_extents);
static Vector<Plane> build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z);
static Vector<Plane> build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z);
static Vector<Plane> build_cylinder_planes(real_t p_radius, real_t p_height, int p_sides, int p_axis = Vector3::AXIS_Z);
static Vector<Plane> build_capsule_planes(real_t p_radius, real_t p_height, int p_sides, int p_lats, int p_axis = Vector3::AXIS_Z);

static Vector<Vector3> compute_convex_mesh_points(const Plane *p_planes, int p_plane_count);

Expand Down
4 changes: 2 additions & 2 deletions doc/classes/Geometry3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<param index="3" name="lats" type="int" />
<param index="4" name="axis" type="int" enum="Vector3.Axis" default="2" />
<description>
Returns an array of [Plane]s closely bounding a faceted capsule centered at the origin with radius [param radius] and height [param height]. The parameter [param sides] defines how many planes will be generated for the side part of the capsule, whereas [param lats] gives the number of latitudinal steps at the bottom and top of the capsule. The parameter [param axis] describes the axis along which the capsule is oriented (0 for X, 1 for Y, 2 for Z).
Returns an array of [Plane]s closely bounding a faceted capsule centered at the origin with radius [param radius] and height [param height]. The parameter [param sides] defines how many planes will be generated for the side part of the capsule, whereas [param lats] gives the number of latitudinal steps at the bottom and top of the capsule. The parameter [param axis] describes the index of the axis along which the capsule is oriented (see [constant Vector3.AXIS_X], [constant Vector3.AXIS_Y], and [constant Vector3.AXIS_Z]).
</description>
</method>
<method name="build_cylinder_planes">
Expand All @@ -34,7 +34,7 @@
<param index="2" name="sides" type="int" />
<param index="3" name="axis" type="int" enum="Vector3.Axis" default="2" />
<description>
Returns an array of [Plane]s closely bounding a faceted cylinder centered at the origin with radius [param radius] and height [param height]. The parameter [param sides] defines how many planes will be generated for the round part of the cylinder. The parameter [param axis] describes the axis along which the cylinder is oriented (0 for X, 1 for Y, 2 for Z).
Returns an array of [Plane]s closely bounding a faceted cylinder centered at the origin with radius [param radius] and height [param height]. The parameter [param sides] defines how many planes will be generated for the round part of the cylinder. The parameter [param axis] describes the index of the axis along which the cylinder is oriented (see [constant Vector3.AXIS_X], [constant Vector3.AXIS_Y], and [constant Vector3.AXIS_Z]).
</description>
</method>
<method name="clip_polygon">
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/LookAtModifier3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<member name="primary_positive_limit_angle" type="float" setter="set_primary_positive_limit_angle" getter="get_primary_positive_limit_angle">
The limit angle of positive side of the primary rotation when [member symmetry_limitation] is [code]false[/code].
</member>
<member name="primary_rotation_axis" type="int" setter="set_primary_rotation_axis" getter="get_primary_rotation_axis" enum="Vector3.Axis" default="1">
The axis of the first rotation. This [SkeletonModifier3D] works by compositing the rotation by Euler angles to prevent to rotate the [member forward_axis].
<member name="primary_rotation_axis" type="int" setter="set_primary_rotation_axis" getter="get_primary_rotation_axis" default="1">
The index of the axis of the first rotation. This [SkeletonModifier3D] works by compositing the rotation by Euler angles to prevent to rotate the [member forward_axis] (see [constant Vector3.AXIS_X], [constant Vector3.AXIS_Y], and [constant Vector3.AXIS_Z]).
</member>
<member name="secondary_damp_threshold" type="float" setter="set_secondary_damp_threshold" getter="get_secondary_damp_threshold">
The threshold to start damping for [member secondary_limit_angle].
Expand Down
8 changes: 4 additions & 4 deletions doc/classes/PhysicsServer3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@
<method name="generic_6dof_joint_get_flag" qualifiers="const">
<return type="bool" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" />
<description>
Returns the value of a generic 6DOF joint flag. See [enum G6DOFJointAxisFlag] for the list of available flags.
Expand All @@ -764,7 +764,7 @@
<method name="generic_6dof_joint_get_param" qualifiers="const">
<return type="float" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" />
<description>
Returns the value of a generic 6DOF joint parameter. See [enum G6DOFJointAxisParam] for the list of available parameters.
Expand All @@ -773,7 +773,7 @@
<method name="generic_6dof_joint_set_flag">
<return type="void" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" />
<param index="3" name="enable" type="bool" />
<description>
Expand All @@ -783,7 +783,7 @@
<method name="generic_6dof_joint_set_param">
<return type="void" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" />
<param index="3" name="value" type="float" />
<description>
Expand Down
8 changes: 4 additions & 4 deletions doc/classes/PhysicsServer3DExtension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -683,23 +683,23 @@
<method name="_generic_6dof_joint_get_flag" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" />
<description>
</description>
</method>
<method name="_generic_6dof_joint_get_param" qualifiers="virtual const">
<return type="float" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" />
<description>
</description>
</method>
<method name="_generic_6dof_joint_set_flag" qualifiers="virtual">
<return type="void" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" />
<param index="3" name="enable" type="bool" />
<description>
Expand All @@ -708,7 +708,7 @@
<method name="_generic_6dof_joint_set_param" qualifiers="virtual">
<return type="void" />
<param index="0" name="joint" type="RID" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="1" name="axis" type="int" />
<param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" />
<param index="3" name="value" type="float" />
<description>
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/SpriteBase3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
<member name="alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold" default="0.5">
Threshold at which the alpha scissor will discard values.
</member>
<member name="axis" type="int" setter="set_axis" getter="get_axis" enum="Vector3.Axis" default="2">
The direction in which the front of the texture faces.
<member name="axis" type="int" setter="set_axis" getter="get_axis" default="2">
The index of the axis in which the front of the texture faces (see [constant Vector3.AXIS_X], [constant Vector3.AXIS_Y], and [constant Vector3.AXIS_Z]).
</member>
<member name="billboard" type="int" setter="set_billboard_mode" getter="get_billboard_mode" enum="BaseMaterial3D.BillboardMode" default="0">
The billboard mode to use for the sprite. See [enum BaseMaterial3D.BillboardMode] for possible values.
Expand Down
16 changes: 16 additions & 0 deletions misc/extension_api_validation/4.3-stable.expected
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,19 @@ GH-98918
Validate extension JSON: Error: Field 'classes/FileAccess/methods/open_encrypted/arguments': size changed value in new API, from 3 to 4.

Optional argument added to allow setting initialization vector. Compatibility method registered.


GH-99341
--------
Validate extension JSON: Error: Field 'classes/PhysicsServer3D/methods/generic_6dof_joint_set_param/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/PhysicsServer3D/methods/generic_6dof_joint_get_param/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Comment on lines +129 to +130
Copy link
Contributor

@Bromeon Bromeon Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right approach. Even if binary compatibility is retained, this changes the public API exposed towards extensions.

Bindings such as godot-rust and Swift-Godot have been built around a type Vector3Axis (Rust) or Vector3.Axis (Swift). You can't just remove it because of an issue in set_axis(), while it works everywhere else.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I may (as someone who noticed the issue but isn't proficient in C++), the issue seems to be deeper than just set_axis(), since this PR finds and eliminates references to the same enum in multiple classes. I've just checked & found that the enum Vector3.Axis does exist in the code after all, but trying to access it in GDScript results in errors. If eliminating it breaks compat, then perhaps the right approach would be finding a way to expose it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps the right approach would be finding a way to expose it?

I thought the same but no class has exposed enums, so I thought that wasn't the intended approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Precisely my thoughts. These enums from Variants should be exposed appropriately and used across the codebase like Vector3.Axis is. However, doing so is not straightforward because, unlike enums from classes inheriting Object, there's currently no way to do it.

Copy link

@Sithoid Sithoid Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the same but no class has exposed enums, so I thought that wasn't the intended approach.

Some low-level classes have them; off the top of my head - HTTPClient has enums for Method, Status and ResponseCode.

Copy link
Contributor Author

@PhairZ PhairZ Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bromeon
I looked at other implementations for other classes like Vector4 and Vector2. None of them had that issue, instead they treated Vector2.Axis params and return types as an int. At least for binded methods. So I thought I'd change any binded method that uses Vector3.Axis as param/return type to int.

I basically matched Vector3's implementation with Vector2, Vector2I, Vector3I, Vector4, Vector4I, and Plane

Copy link
Contributor

@Bromeon Bromeon Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Precisely my thoughts. These enums from Variants should be exposed appropriately and used across the codebase like Vector3.Axis is. However, doing so is not straightforward because, unlike enums from classes inheriting Object, there's currently no way to do it.

There are global enums though. They already contain enums such as EulerOrder specific to geometric builtin types, so Vector3Axis and future Vector2Axis/Vector4Axis wouldn't be that out of place.
DitIt would still technically be a compatibility breakage, but we don't just plain remove a valid feature.

  • There's clear continuity; the binding just needs to unederstand both Vector3.Axis and Vector3Axis in the JSON.
  • There's no downgrade in type safety (int may work for GDScript but is a non-starter for other languages).

Edit: what's not so nice with that is that the constants are effectively duplicated. But retrofitting builtin enums seems like a huge endeavour for these few (others like EulerAngle, VariantType, VariantOperator already exist in global scope and can't just be moved...)

Maybe status quo is still the lesser evil?

Copy link
Contributor Author

@PhairZ PhairZ Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are global enums though. They already contain enums such as EulerOrder specific to geometric builtin types, so Vector3Axis and future Vector2Axis/Vector4Axis wouldn't be that out of place.

It would still technically be a compatibility breakage, but we don't just plain remove a valid feature.

  • There's clear continuity; the binding just needs to understand both Vector3.Axis and Vector3Axis in the JSON.
  • There's no downgrade in type safety (int may work for GDScript but is a non-starter for other languages).

What if we just deprecated VectorX.Axis enums and replaced them with @GlobalScope.VectorAxis that would looks something like this

VectorAxis {
    VECTOR_AXIS_X,
    VECTOR_AXIS_Y,
    VECTOR_AXIS_Z,
    VECTOR_AXIS_W
}

that way its only one enum for all vector types

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about a single enum type; you could then pass VECTOR_AXIS_W to an API that expects Vector2.Axis. If all APIs refer to VectorAxis, the documentation aspect (which dimension) also gets lost.

Validate extension JSON: Error: Field 'classes/PhysicsServer3D/methods/generic_6dof_joint_set_flag/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/PhysicsServer3D/methods/generic_6dof_joint_get_flag/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/PhysicsServer3DExtension/methods/_generic_6dof_joint_set_param/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/PhysicsServer3DExtension/methods/_generic_6dof_joint_get_param/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/PhysicsServer3DExtension/methods/_generic_6dof_joint_set_flag/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/PhysicsServer3DExtension/methods/_generic_6dof_joint_get_flag/arguments/1': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/SpriteBase3D/methods/set_axis/arguments/0': type changed value in new API, from "enum::Vector3.Axis" to "int".
Validate extension JSON: Error: Field 'classes/SpriteBase3D/methods/get_axis/return_value': type changed value in new API, from "enum::Vector3.Axis" to "int".

Fix use of non-existent Vector3.Axis enum type in built-in methods and members
50 changes: 50 additions & 0 deletions modules/godot_physics_3d/godot_physics_server_3d.compat.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**************************************************************************/
/* godot_physics_server_3d.compat.inc */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef DISABLE_DEPRECATED
#include "godot_physics_server_3d.h"

void GodotPhysicsServer3D::_generic_6dof_joint_set_param_bind_compat_99341(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, real_t p_value) {
GodotPhysicsServer3D::generic_6dof_joint_set_param(p_joint, (int)p_axis, p_param, p_value);
}

real_t GodotPhysicsServer3D::_generic_6dof_joint_get_param_bind_compat_99341(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) const {
return GodotPhysicsServer3D::generic_6dof_joint_get_param(p_joint, (int)p_axis, p_param);
}

void GodotPhysicsServer3D::_generic_6dof_joint_set_flag_bind_compat_99341(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) {
GodotPhysicsServer3D::generic_6dof_joint_set_flag(p_joint, (int)p_axis, p_flag, p_enable);
}

bool GodotPhysicsServer3D::_generic_6dof_joint_get_flag_bind_compat_99341(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) const {
return GodotPhysicsServer3D::generic_6dof_joint_get_flag(p_joint, (int)p_axis, p_flag);
}

#endif //DISABLE_DEPRECATED
9 changes: 5 additions & 4 deletions modules/godot_physics_3d/godot_physics_server_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**************************************************************************/

#include "godot_physics_server_3d.h"
#include "godot_physics_server_3d.compat.inc"

#include "godot_body_direct_state_3d.h"
#include "godot_broad_phase_3d_bvh.h"
Expand Down Expand Up @@ -1521,31 +1522,31 @@ void GodotPhysicsServer3D::joint_make_generic_6dof(RID p_joint, RID p_body_A, co
memdelete(prev_joint);
}

void GodotPhysicsServer3D::generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, real_t p_value) {
void GodotPhysicsServer3D::generic_6dof_joint_set_param(RID p_joint, int p_axis, G6DOFJointAxisParam p_param, real_t p_value) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_6DOF);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
generic_6dof_joint->set_param(p_axis, p_param, p_value);
}

real_t GodotPhysicsServer3D::generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) const {
real_t GodotPhysicsServer3D::generic_6dof_joint_get_param(RID p_joint, int p_axis, G6DOFJointAxisParam p_param) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
ERR_FAIL_NULL_V(joint, 0);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_6DOF, 0);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
return generic_6dof_joint->get_param(p_axis, p_param);
}

void GodotPhysicsServer3D::generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) {
void GodotPhysicsServer3D::generic_6dof_joint_set_flag(RID p_joint, int p_axis, G6DOFJointAxisFlag p_flag, bool p_enable) {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
ERR_FAIL_NULL(joint);
ERR_FAIL_COND(joint->get_type() != JOINT_TYPE_6DOF);
GodotGeneric6DOFJoint3D *generic_6dof_joint = static_cast<GodotGeneric6DOFJoint3D *>(joint);
generic_6dof_joint->set_flag(p_axis, p_flag, p_enable);
}

bool GodotPhysicsServer3D::generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisFlag p_flag) const {
bool GodotPhysicsServer3D::generic_6dof_joint_get_flag(RID p_joint, int p_axis, G6DOFJointAxisFlag p_flag) const {
GodotJoint3D *joint = joint_owner.get_or_null(p_joint);
ERR_FAIL_NULL_V(joint, false);
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_6DOF, false);
Expand Down
17 changes: 13 additions & 4 deletions modules/godot_physics_3d/godot_physics_server_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,20 @@ class GodotPhysicsServer3D : public PhysicsServer3D {

virtual void joint_make_generic_6dof(RID p_joint, RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override; //reference frame is A

virtual void generic_6dof_joint_set_param(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param, real_t p_value) override;
virtual real_t generic_6dof_joint_get_param(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param) const override;
virtual void generic_6dof_joint_set_param(RID p_joint, int, G6DOFJointAxisParam p_param, real_t p_value) override;
virtual real_t generic_6dof_joint_get_param(RID p_joint, int, G6DOFJointAxisParam p_param) const override;

virtual void generic_6dof_joint_set_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) override;
virtual bool generic_6dof_joint_get_flag(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) const override;
virtual void generic_6dof_joint_set_flag(RID p_joint, int, G6DOFJointAxisFlag p_flag, bool p_enable) override;
virtual bool generic_6dof_joint_get_flag(RID p_joint, int, G6DOFJointAxisFlag p_flag) const override;

#ifndef DISABLE_DEPRECATED
virtual void _generic_6dof_joint_set_param_bind_compat_99341(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param, real_t p_value) override;
virtual real_t _generic_6dof_joint_get_param_bind_compat_99341(RID p_joint, Vector3::Axis, G6DOFJointAxisParam p_param) const override;

virtual void _generic_6dof_joint_set_flag_bind_compat_99341(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag, bool p_enable) override;
virtual bool _generic_6dof_joint_get_flag_bind_compat_99341(RID p_joint, Vector3::Axis, G6DOFJointAxisFlag p_flag) const override;

#endif //DISABLE_DEPRECATED

virtual JointType joint_get_type(RID p_joint) const override;

Expand Down
Loading