Bind constants related to 6DOF joints

This makes physics server GDExtensions able to use the enums without
workarounds.
This commit is contained in:
Ricardo Buring 2024-03-24 15:16:33 +01:00
parent 99ff024f78
commit 38a31f4cb5
2 changed files with 37 additions and 4 deletions

View File

@ -740,7 +740,7 @@
<param index="1" name="axis" type="int" enum="Vector3.Axis" /> <param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" /> <param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" />
<description> <description>
Gets a generic_6_DOF_joint flag (see [enum G6DOFJointAxisFlag] constants). Returns the value of a generic 6DOF joint flag. See [enum G6DOFJointAxisFlag] for the list of available flags.
</description> </description>
</method> </method>
<method name="generic_6dof_joint_get_param" qualifiers="const"> <method name="generic_6dof_joint_get_param" qualifiers="const">
@ -749,7 +749,7 @@
<param index="1" name="axis" type="int" enum="Vector3.Axis" /> <param index="1" name="axis" type="int" enum="Vector3.Axis" />
<param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" /> <param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" />
<description> <description>
Gets a generic_6_DOF_joint parameter (see [enum G6DOFJointAxisParam] constants). Returns the value of a generic 6DOF joint parameter. See [enum G6DOFJointAxisParam] for the list of available parameters.
</description> </description>
</method> </method>
<method name="generic_6dof_joint_set_flag"> <method name="generic_6dof_joint_set_flag">
@ -759,7 +759,7 @@
<param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" /> <param index="2" name="flag" type="int" enum="PhysicsServer3D.G6DOFJointAxisFlag" />
<param index="3" name="enable" type="bool" /> <param index="3" name="enable" type="bool" />
<description> <description>
Sets a generic_6_DOF_joint flag (see [enum G6DOFJointAxisFlag] constants). Sets the value of a given generic 6DOF joint flag. See [enum G6DOFJointAxisFlag] for the list of available flags.
</description> </description>
</method> </method>
<method name="generic_6dof_joint_set_param"> <method name="generic_6dof_joint_set_param">
@ -769,7 +769,7 @@
<param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" /> <param index="2" name="param" type="int" enum="PhysicsServer3D.G6DOFJointAxisParam" />
<param index="3" name="value" type="float" /> <param index="3" name="value" type="float" />
<description> <description>
Sets a generic_6_DOF_joint parameter (see [enum G6DOFJointAxisParam] constants). Sets the value of a given generic 6DOF joint parameter. See [enum G6DOFJointAxisParam] for the list of available parameters.
</description> </description>
</method> </method>
<method name="get_process_info"> <method name="get_process_info">
@ -876,6 +876,7 @@
<param index="3" name="body_B" type="RID" /> <param index="3" name="body_B" type="RID" />
<param index="4" name="local_ref_B" type="Transform3D" /> <param index="4" name="local_ref_B" type="Transform3D" />
<description> <description>
Make the joint a generic six degrees of freedom (6DOF) joint. Use [method generic_6dof_joint_set_flag] and [method generic_6dof_joint_set_param] to set the joint's flags and parameters respectively.
</description> </description>
</method> </method>
<method name="joint_make_hinge"> <method name="joint_make_hinge">
@ -1497,6 +1498,12 @@
<constant name="G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT" value="6" enum="G6DOFJointAxisParam"> <constant name="G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT" value="6" enum="G6DOFJointAxisParam">
The maximum force that the linear motor can apply while trying to reach the target velocity. The maximum force that the linear motor can apply while trying to reach the target velocity.
</constant> </constant>
<constant name="G6DOF_JOINT_LINEAR_SPRING_STIFFNESS" value="7" enum="G6DOFJointAxisParam">
</constant>
<constant name="G6DOF_JOINT_LINEAR_SPRING_DAMPING" value="8" enum="G6DOFJointAxisParam">
</constant>
<constant name="G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT" value="9" enum="G6DOFJointAxisParam">
</constant>
<constant name="G6DOF_JOINT_ANGULAR_LOWER_LIMIT" value="10" enum="G6DOFJointAxisParam"> <constant name="G6DOF_JOINT_ANGULAR_LOWER_LIMIT" value="10" enum="G6DOFJointAxisParam">
The minimum rotation in negative direction to break loose and rotate around the axes. The minimum rotation in negative direction to break loose and rotate around the axes.
</constant> </constant>
@ -1524,18 +1531,34 @@
<constant name="G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT" value="18" enum="G6DOFJointAxisParam"> <constant name="G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT" value="18" enum="G6DOFJointAxisParam">
Maximum acceleration for the motor at the axes. Maximum acceleration for the motor at the axes.
</constant> </constant>
<constant name="G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS" value="19" enum="G6DOFJointAxisParam">
</constant>
<constant name="G6DOF_JOINT_ANGULAR_SPRING_DAMPING" value="20" enum="G6DOFJointAxisParam">
</constant>
<constant name="G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT" value="21" enum="G6DOFJointAxisParam">
</constant>
<constant name="G6DOF_JOINT_MAX" value="22" enum="G6DOFJointAxisParam">
Represents the size of the [enum G6DOFJointAxisParam] enum.
</constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT" value="0" enum="G6DOFJointAxisFlag"> <constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT" value="0" enum="G6DOFJointAxisFlag">
If set, linear motion is possible within the given limits. If set, linear motion is possible within the given limits.
</constant> </constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT" value="1" enum="G6DOFJointAxisFlag"> <constant name="G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT" value="1" enum="G6DOFJointAxisFlag">
If set, rotational motion is possible. If set, rotational motion is possible.
</constant> </constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING" value="2" enum="G6DOFJointAxisFlag">
</constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING" value="3" enum="G6DOFJointAxisFlag">
</constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_MOTOR" value="4" enum="G6DOFJointAxisFlag"> <constant name="G6DOF_JOINT_FLAG_ENABLE_MOTOR" value="4" enum="G6DOFJointAxisFlag">
If set, there is a rotational motor across these axes. If set, there is a rotational motor across these axes.
</constant> </constant>
<constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR" value="5" enum="G6DOFJointAxisFlag"> <constant name="G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR" value="5" enum="G6DOFJointAxisFlag">
If set, there is a linear motor on this axis that targets a specific velocity. If set, there is a linear motor on this axis that targets a specific velocity.
</constant> </constant>
<constant name="G6DOF_JOINT_FLAG_MAX" value="6" enum="G6DOFJointAxisFlag">
Represents the size of the [enum G6DOFJointAxisFlag] enum.
</constant>
<constant name="SHAPE_WORLD_BOUNDARY" value="0" enum="ShapeType"> <constant name="SHAPE_WORLD_BOUNDARY" value="0" enum="ShapeType">
The [Shape3D] is a [WorldBoundaryShape3D]. The [Shape3D] is a [WorldBoundaryShape3D].
</constant> </constant>

View File

@ -985,6 +985,9 @@ void PhysicsServer3D::_bind_methods() {
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING); BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY); BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_MOTOR_TARGET_VELOCITY);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT); BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_MOTOR_FORCE_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_SPRING_STIFFNESS);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_SPRING_DAMPING);
BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_SPRING_EQUILIBRIUM_POINT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT); BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT); BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS); BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS);
@ -994,11 +997,18 @@ void PhysicsServer3D::_bind_methods() {
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_ERP); BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_ERP);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY); BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT); BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_SPRING_STIFFNESS);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_SPRING_DAMPING);
BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_SPRING_EQUILIBRIUM_POINT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_MAX);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT); BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT); BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_SPRING);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_SPRING);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR); BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR); BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_MOTOR);
BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_MAX);
ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer3D::joint_get_type); ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer3D::joint_get_type);