Skip to content

Commit 480b034

Browse files
committed
Add units and docs for Joint3D/2D stiffness and damping
1 parent b5bdb88 commit 480b034

14 files changed

+208
-143
lines changed

doc/classes/ConeTwistJoint3D.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
The higher, the faster.
3232
</member>
3333
<member name="relaxation" type="float" setter="set_param" getter="get_param" default="1.0">
34-
Defines, how fast the swing- and twist-speed-difference on both sides gets synced.
34+
The amount of relaxation, or inverse damping, applied to angular velocity when rotated beyond the swing span and/or twist span. It is measured in rad/N/m/s, or rad·s/kg/m² in SI base units. Unlike most joints in Godot which use damping, [ConeTwistJoint3D] uses inverse damping (relaxation), so higher values result in less damping and lower values result in more damping.
35+
Higher relaxation values make the joint more elastic or bouncy. Lower values result in a smoother, more gradual reduction in swing and twist speed difference velocity, preventing oscillations or rapid rotation as the joint returns to its span limits.
3536
</member>
3637
<member name="softness" type="float" setter="set_param" getter="get_param" default="0.8">
37-
The ease with which the joint starts to twist. If it's too low, it takes more force to start twisting the joint.
38+
The stiffness factor applied to rotation beyond the swing span and twist span limits. It is measured in N·m/rad, or kg·m²/s²/rad in SI base units.
39+
Higher angular stiffness results in a harder limit, which more strongly resists rotation beyond the limit. Lower values make the limit softer and more flexible.
3840
</member>
3941
<member name="swing_span" type="float" setter="set_param" getter="get_param" default="0.785398">
4042
Swing is rotation from side to side, around the axis perpendicular to the twist axis.

doc/classes/DampedSpringJoint2D.xml

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
</tutorials>
1111
<members>
1212
<member name="damping" type="float" setter="set_damping" getter="get_damping" default="1.0">
13-
The spring joint's damping ratio. A value between [code]0[/code] and [code]1[/code]. When the two bodies move into different directions the system tries to align them to the spring axis again. A high [member damping] value forces the attached bodies to align faster.
13+
The amount of damping applied to by the spring joint. It is measured in kg/s.
14+
Higher linear damping results in a more gradual reduction in linear velocity, creating smoother, gentler behavior as the spring returns to its equilibrium rest length, preventing oscillations or rapid movement. Lower values make the spring more elastic or bouncy.
1415
</member>
1516
<member name="length" type="float" setter="set_length" getter="get_length" default="50.0">
1617
The spring joint's maximum length. The two attached bodies cannot stretch it past this value.
1718
</member>
1819
<member name="rest_length" type="float" setter="set_rest_length" getter="get_rest_length" default="0.0">
19-
When the bodies attached to the spring joint move they stretch or squash it. The joint always tries to resize towards this length.
20+
When the bodies attached to the spring joint move they stretch or squash it. The joint always tries to resize towards this length, known as the equilibrium length or rest length.
2021
</member>
2122
<member name="stiffness" type="float" setter="set_stiffness" getter="get_stiffness" default="20.0">
22-
The higher the value, the less the bodies attached to the joint will deform it. The joint applies an opposing force to the bodies, the product of the stiffness multiplied by the size difference from its resting length.
23+
The stiffness of the spring joint. It is measured in kg/s². The joint applies an opposing force to the bodies, the product of the stiffness multiplied by the size difference from its resting length.
24+
Higher linear stiffness results in a more rigid spring, which more strongly resists being compressed or stretched away from its equilibrium rest length. Lower values make the spring more elastic or bouncy.
2325
</member>
2426
</members>
2527
</class>

doc/classes/Generic6DOFJoint3D.xml

+126-67
Large diffs are not rendered by default.

doc/classes/HingeJoint3D.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@
5151
The minimum rotation. Only active if [member angular_limit/enable] is [code]true[/code].
5252
</member>
5353
<member name="angular_limit/relaxation" type="float" setter="set_param" getter="get_param" default="1.0">
54-
The lower this value, the more the rotation gets slowed down.
54+
The amount of relaxation, or inverse damping, applied to angular velocity when the hinge is rotated beyond the angular limit around the Z axis. It is measured in rad/N/m/s, or rad·s/kg/m² in SI base units. Unlike most joints in Godot which use damping, HingeJoint3D uses inverse damping (relaxation), so higher values result in less damping and lower values result in more damping.
55+
Higher relaxation values make the joint more elastic or bouncy. Lower values result in a smoother, more gradual reduction in angular velocity, preventing oscillations or rapid rotation as the joint returns to its angular limit.
5556
</member>
5657
<member name="angular_limit/softness" type="float" setter="set_param" getter="get_param" default="0.9" deprecated="This property is never set by the engine and is kept for compatibility purposes.">
58+
The stiffness factor applied to rotation beyond the hinge's angular limit around the Z axis. It is measured in N·m/rad, or kg·m²/s²/rad in SI base units.
59+
Higher angular stiffness results in a harder limit, which more strongly resists rotation beyond the limit. Lower values make the limit softer and more flexible.
5760
</member>
5861
<member name="angular_limit/upper" type="float" setter="set_param" getter="get_param" default="1.5708">
5962
The maximum rotation. Only active if [member angular_limit/enable] is [code]true[/code].

doc/classes/PinJoint2D.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Target speed for the motor. In radians per second.
2626
</member>
2727
<member name="softness" type="float" setter="set_softness" getter="get_softness" default="0.0">
28-
The higher this value, the more the bond to the pinned partner can flex.
28+
The higher this value, the more the bond to the pinned partner can flex. Lower values are stiffer, while higher values are softer. It is measured in s²/kg.
2929
</member>
3030
</members>
3131
</class>

doc/classes/PinJoint3D.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,23 @@
3030
The force with which the pinned objects stay in positional relation to each other. The higher, the stronger.
3131
</member>
3232
<member name="params/damping" type="float" setter="set_param" getter="get_param" default="1.0">
33-
The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger.
33+
The amount of damping applied to linear velocity. It is measured in N·s/m, or kg/s in SI base units.
34+
Higher linear damping results in a more gradual reduction in linear velocity, creating smoother, gentler behavior as the joint returns to its limit, preventing oscillations or rapid movement. Lower values make the joint more elastic or bouncy.
3435
</member>
3536
<member name="params/impulse_clamp" type="float" setter="set_param" getter="get_param" default="0.0">
36-
If above 0, this value is the maximum value for an impulse that this Joint3D produces.
37+
If above 0, this value is the maximum value for an impulse that this Joint3D produces. It is measured in N·s, or kg·m/s in SI base units.
3738
</member>
3839
</members>
3940
<constants>
4041
<constant name="PARAM_BIAS" value="0" enum="Param">
4142
The force with which the pinned objects stay in positional relation to each other. The higher, the stronger.
4243
</constant>
4344
<constant name="PARAM_DAMPING" value="1" enum="Param">
44-
The force with which the pinned objects stay in velocity relation to each other. The higher, the stronger.
45+
The amount of damping applied to linear velocity. It is measured in N·s/m, or kg/s in SI base units.
46+
Higher linear damping results in a more gradual reduction in linear velocity, creating smoother, gentler behavior as the joint returns to its limit, preventing oscillations or rapid movement. Lower values make the joint more elastic or bouncy.
4547
</constant>
4648
<constant name="PARAM_IMPULSE_CLAMP" value="2" enum="Param">
47-
If above 0, this value is the maximum value for an impulse that this Joint3D produces.
49+
If above 0, this value is the maximum value for an impulse that this Joint3D produces. It is measured in N·s, or kg·m/s in SI base units.
4850
</constant>
4951
</constants>
5052
</class>

doc/classes/SliderJoint3D.xml

+17-20
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,37 @@
2727
</methods>
2828
<members>
2929
<member name="angular_limit/damping" type="float" setter="set_param" getter="get_param" default="0.0">
30-
The amount of damping of the rotation when the limit is surpassed.
31-
A lower damping value allows a rotation initiated by body A to travel to body B slower.
30+
The amount of damping of the rotation when the limit is surpassed. A lower damping value allows a rotation initiated by body A to travel to body B slower. It is measured in N·m·s/rad, or kg·m²/s/rad in SI base units.
3231
</member>
3332
<member name="angular_limit/lower_angle" type="float" setter="set_param" getter="get_param" default="0.0">
3433
The lower limit of rotation in the slider.
3534
</member>
3635
<member name="angular_limit/restitution" type="float" setter="set_param" getter="get_param" default="0.7">
37-
The amount of restitution of the rotation when the limit is surpassed.
38-
Does not affect damping.
36+
The amount of restitution of the rotation when the limit is surpassed. Does not affect damping. Restitution is a dimensionless value.
3937
</member>
4038
<member name="angular_limit/softness" type="float" setter="set_param" getter="get_param" default="1.0">
41-
A factor applied to the all rotation once the limit is surpassed.
42-
Makes all rotation slower when between 0 and 1.
39+
The stiffness factor applied to the all rotation once the limit is surpassed. Makes all rotation slower when between 0 and 1. Lower values are softer, while higher values are stiffer. It is measured in N·m/rad, or kg·m²/s²/rad in SI base units.
4340
</member>
4441
<member name="angular_limit/upper_angle" type="float" setter="set_param" getter="get_param" default="0.0">
4542
The upper limit of rotation in the slider.
4643
</member>
4744
<member name="angular_motion/damping" type="float" setter="set_param" getter="get_param" default="1.0">
48-
The amount of damping of the rotation in the limits.
45+
The amount of damping of the rotation in the limits. It is measured in N·m·s/rad, or kg·m²/s/rad in SI base units.
4946
</member>
5047
<member name="angular_motion/restitution" type="float" setter="set_param" getter="get_param" default="0.7">
51-
The amount of restitution of the rotation in the limits.
48+
The amount of restitution of the rotation in the limits. Restitution is a dimensionless value.
5249
</member>
5350
<member name="angular_motion/softness" type="float" setter="set_param" getter="get_param" default="1.0">
54-
A factor applied to the all rotation in the limits.
51+
The stiffness factor applied to the all rotation in the limits. It is measured in N·m/rad, or kg·m²/s²/rad in SI base units.
5552
</member>
5653
<member name="angular_ortho/damping" type="float" setter="set_param" getter="get_param" default="1.0">
57-
The amount of damping of the rotation across axes orthogonal to the slider.
54+
The amount of damping of the rotation across axes orthogonal to the slider. It is measured in N·m·s/rad, or kg·m²/s/rad in SI base units.
5855
</member>
5956
<member name="angular_ortho/restitution" type="float" setter="set_param" getter="get_param" default="0.7">
60-
The amount of restitution of the rotation across axes orthogonal to the slider.
57+
The amount of restitution of the rotation across axes orthogonal to the slider. Restitution is a dimensionless value.
6158
</member>
6259
<member name="angular_ortho/softness" type="float" setter="set_param" getter="get_param" default="1.0">
63-
A factor applied to the all rotation across axes orthogonal to the slider.
60+
The stiffness factor applied to the all rotation across axes orthogonal to the slider. It is measured in N·m/rad, or kg·m²/s²/rad in SI base units.
6461
</member>
6562
<member name="linear_limit/damping" type="float" setter="set_param" getter="get_param" default="1.0">
6663
The amount of damping that happens once the limit defined by [member linear_limit/lower_distance] and [member linear_limit/upper_distance] is surpassed.
@@ -69,31 +66,31 @@
6966
The minimum difference between the pivot points on their X axis before damping happens.
7067
</member>
7168
<member name="linear_limit/restitution" type="float" setter="set_param" getter="get_param" default="0.7">
72-
The amount of restitution once the limits are surpassed. The lower, the more velocity-energy gets lost.
69+
The amount of restitution once the limits are surpassed. The lower, the more velocity-energy gets lost. Restitution is a dimensionless value.
7370
</member>
7471
<member name="linear_limit/softness" type="float" setter="set_param" getter="get_param" default="1.0">
75-
A factor applied to the movement across the slider axis once the limits get surpassed. The lower, the slower the movement.
72+
The stiffness factor applied to the movement across the slider axis once the limits get surpassed. The lower, the slower the movement. It is measured in N/m, or kg/s² in SI base units.
7673
</member>
7774
<member name="linear_limit/upper_distance" type="float" setter="set_param" getter="get_param" default="1.0">
7875
The maximum difference between the pivot points on their X axis before damping happens.
7976
</member>
8077
<member name="linear_motion/damping" type="float" setter="set_param" getter="get_param" default="0.0">
81-
The amount of damping inside the slider limits.
78+
The amount of damping inside the slider limits. It is measured in N·s/m, or kg/s in SI base units.
8279
</member>
8380
<member name="linear_motion/restitution" type="float" setter="set_param" getter="get_param" default="0.7">
84-
The amount of restitution inside the slider limits.
81+
The amount of restitution inside the slider limits. Restitution is a dimensionless value.
8582
</member>
8683
<member name="linear_motion/softness" type="float" setter="set_param" getter="get_param" default="1.0">
87-
A factor applied to the movement across the slider axis as long as the slider is in the limits. The lower, the slower the movement.
84+
The stiffness factor applied to the movement across the slider axis as long as the slider is in the limits. The lower, the slower the movement. It is measured in N/m, or kg/s² in SI base units.
8885
</member>
8986
<member name="linear_ortho/damping" type="float" setter="set_param" getter="get_param" default="1.0">
90-
The amount of damping when movement is across axes orthogonal to the slider.
87+
The amount of damping when movement is across axes orthogonal to the slider. It is measured in N·s/m, or kg/s in SI base units.
9188
</member>
9289
<member name="linear_ortho/restitution" type="float" setter="set_param" getter="get_param" default="0.7">
93-
The amount of restitution when movement is across axes orthogonal to the slider.
90+
The amount of restitution when movement is across axes orthogonal to the slider. Restitution is a dimensionless value.
9491
</member>
9592
<member name="linear_ortho/softness" type="float" setter="set_param" getter="get_param" default="1.0">
96-
A factor applied to the movement across axes orthogonal to the slider.
93+
The stiffness factor applied to the movement across axes orthogonal to the slider. Lower values are softer, while higher values are stiffer. It is measured in N/m, or kg/s² in SI base units.
9794
</member>
9895
</members>
9996
<constants>

scene/2d/physics/joints/damped_spring_joint_2d.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ void DampedSpringJoint2D::_bind_methods() {
120120

121121
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "1,65535,1,exp,suffix:px"), "set_length", "get_length");
122122
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "rest_length", PROPERTY_HINT_RANGE, "0,65535,1,exp,suffix:px"), "set_rest_length", "get_rest_length");
123-
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "stiffness", PROPERTY_HINT_RANGE, "0.1,64,0.1,exp"), "set_stiffness", "get_stiffness");
124-
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "damping", PROPERTY_HINT_RANGE, "0.01,16,0.01,exp"), "set_damping", "get_damping");
123+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "stiffness", PROPERTY_HINT_RANGE, U"0.1,64,0.1,exp,suffix:kg/s\u00B2"), "set_stiffness", "get_stiffness");
124+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "damping", PROPERTY_HINT_RANGE, "0.01,16,0.01,exp,suffix:kg/s"), "set_damping", "get_damping");
125125
}
126126

127127
DampedSpringJoint2D::DampedSpringJoint2D() {

scene/2d/physics/joints/pin_joint_2d.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void PinJoint2D::_bind_methods() {
163163
ClassDB::bind_method(D_METHOD("set_angular_limit_enabled", "enabled"), &PinJoint2D::set_angular_limit_enabled);
164164
ClassDB::bind_method(D_METHOD("is_angular_limit_enabled"), &PinJoint2D::is_angular_limit_enabled);
165165

166-
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "softness", PROPERTY_HINT_RANGE, "0.00,16,0.01,exp"), "set_softness", "get_softness");
166+
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "softness", PROPERTY_HINT_RANGE, U"0.00,16,0.01,exp,suffix:s\u00B2/kg"), "set_softness", "get_softness");
167167
ADD_GROUP("Angular Limit", "angular_limit_");
168168
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "angular_limit_enabled"), "set_angular_limit_enabled", "is_angular_limit_enabled");
169169
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "angular_limit_lower", PROPERTY_HINT_RANGE, "-180,180,0.1,radians_as_degrees"), "set_angular_limit_lower", "get_angular_limit_lower");

scene/3d/physics/joints/cone_twist_joint_3d.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ void ConeTwistJoint3D::_bind_methods() {
3838
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "twist_span", PROPERTY_HINT_RANGE, "-40000,40000,0.1,radians_as_degrees"), "set_param", "get_param", PARAM_TWIST_SPAN);
3939

4040
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "bias", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_BIAS);
41-
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "softness", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_SOFTNESS);
42-
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "relaxation", PROPERTY_HINT_RANGE, "0.01,16.0,0.01"), "set_param", "get_param", PARAM_RELAXATION);
41+
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "softness", PROPERTY_HINT_RANGE, U"0.01,16.0,0.01,suffix:kg\u22C5m\u00B2/s\u00B2/rad (N\u22C5m/rad)"), "set_param", "get_param", PARAM_SOFTNESS);
42+
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "relaxation", PROPERTY_HINT_RANGE, U"0.01,16.0,0.01,suffix:rad\u22C5s/kg/m\u00B2 (rad/N/m/s) (inverse damping)"), "set_param", "get_param", PARAM_RELAXATION);
4343

4444
BIND_ENUM_CONSTANT(PARAM_SWING_SPAN);
4545
BIND_ENUM_CONSTANT(PARAM_TWIST_SPAN);

0 commit comments

Comments
 (0)