Merge pull request #70708 from rburing/bind_pin_joint_set_param_2d

Bind setter and getter for pin joint parameters in `PhysicsServer2D`
This commit is contained in:
Rémi Verschelde 2023-01-03 12:39:43 +01:00
commit 432c0dee7c
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 20 additions and 0 deletions

View file

@ -805,6 +805,23 @@
Sets a joint parameter. See [enum JointParam] for a list of available parameters.
</description>
</method>
<method name="pin_joint_get_param" qualifiers="const">
<return type="float" />
<param index="0" name="joint" type="RID" />
<param index="1" name="param" type="int" enum="PhysicsServer2D.PinJointParam" />
<description>
Returns the value of a pin joint parameter. See [enum PinJointParam] for a list of available parameters.
</description>
</method>
<method name="pin_joint_set_param">
<return type="void" />
<param index="0" name="joint" type="RID" />
<param index="1" name="param" type="int" enum="PhysicsServer2D.PinJointParam" />
<param index="2" name="value" type="float" />
<description>
Sets a pin joint parameter. See [enum PinJointParam] for a list of available parameters.
</description>
</method>
<method name="rectangle_shape_create">
<return type="RID" />
<description>

View file

@ -772,6 +772,9 @@ void PhysicsServer2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("joint_make_groove", "joint", "groove1_a", "groove2_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::joint_make_groove, DEFVAL(RID()), DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("joint_make_damped_spring", "joint", "anchor_a", "anchor_b", "body_a", "body_b"), &PhysicsServer2D::joint_make_damped_spring, DEFVAL(RID()));
ClassDB::bind_method(D_METHOD("pin_joint_set_param", "joint", "param", "value"), &PhysicsServer2D::pin_joint_set_param);
ClassDB::bind_method(D_METHOD("pin_joint_get_param", "joint", "param"), &PhysicsServer2D::pin_joint_get_param);
ClassDB::bind_method(D_METHOD("damped_spring_joint_set_param", "joint", "param", "value"), &PhysicsServer2D::damped_spring_joint_set_param);
ClassDB::bind_method(D_METHOD("damped_spring_joint_get_param", "joint", "param"), &PhysicsServer2D::damped_spring_joint_get_param);