Skip to content

Commit 9875cb6

Browse files
committed
Merge pull request godotengine#101652 from TokageItLab/gravity-doc-springbone
Clarify `SpringBoneSimulator3D`'s gravity units and improve documentation
2 parents 923eb44 + 8eb5443 commit 9875cb6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/classes/SpringBoneSimulator3D.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
<param index="0" name="index" type="int" />
448448
<param index="1" name="gravity" type="float" />
449449
<description>
450-
Sets the gravity amount of the bone chain.
450+
Sets the gravity amount of the bone chain. This value is not an acceleration, but a constant velocity of movement in [method set_gravity_direction].
451451
If [param gravity] is not [code]0[/code], the modified pose will not return to the original pose since it is always affected by gravity.
452452
The value is scaled by [method set_gravity_damping_curve] and cached in each joint setting in the joint list.
453453
</description>
@@ -465,7 +465,7 @@
465465
<param index="0" name="index" type="int" />
466466
<param index="1" name="gravity_direction" type="Vector3" />
467467
<description>
468-
Sets the gravity direction of the bone chain.
468+
Sets the gravity direction of the bone chain. This value is internally normalized and then multiplied by [method set_gravity].
469469
The value is cached in each joint setting in the joint list.
470470
</description>
471471
</method>

scene/3d/spring_bone_simulator_3d.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void SpringBoneSimulator3D::_get_property_list(List<PropertyInfo> *p_list) const
302302
p_list->push_back(PropertyInfo(Variant::OBJECT, path + "stiffness/damping_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"));
303303
p_list->push_back(PropertyInfo(Variant::FLOAT, path + "drag/value", PROPERTY_HINT_RANGE, "0,1,0.01,or_greater"));
304304
p_list->push_back(PropertyInfo(Variant::OBJECT, path + "drag/damping_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"));
305-
p_list->push_back(PropertyInfo(Variant::FLOAT, path + "gravity/value", PROPERTY_HINT_RANGE, "0,1,0.01,or_greater"));
305+
p_list->push_back(PropertyInfo(Variant::FLOAT, path + "gravity/value", PROPERTY_HINT_RANGE, "0,1,0.01,or_greater,or_less,suffix:m/s"));
306306
p_list->push_back(PropertyInfo(Variant::OBJECT, path + "gravity/damping_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"));
307307
p_list->push_back(PropertyInfo(Variant::VECTOR3, path + "gravity/direction"));
308308
p_list->push_back(PropertyInfo(Variant::INT, path + "joint_count", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_ARRAY, "Joints," + path + "joints/,static,const"));
@@ -314,7 +314,7 @@ void SpringBoneSimulator3D::_get_property_list(List<PropertyInfo> *p_list) const
314314
p_list->push_back(PropertyInfo(Variant::FLOAT, joint_path + "radius", PROPERTY_HINT_RANGE, "0,1,0.001,or_greater,suffix:m"));
315315
p_list->push_back(PropertyInfo(Variant::FLOAT, joint_path + "stiffness", PROPERTY_HINT_RANGE, "0,4,0.01,or_greater"));
316316
p_list->push_back(PropertyInfo(Variant::FLOAT, joint_path + "drag", PROPERTY_HINT_RANGE, "0,1,0.01,or_greater"));
317-
p_list->push_back(PropertyInfo(Variant::FLOAT, joint_path + "gravity", PROPERTY_HINT_RANGE, "0,1,0.01,or_greater"));
317+
p_list->push_back(PropertyInfo(Variant::FLOAT, joint_path + "gravity", PROPERTY_HINT_RANGE, "0,1,0.01,or_greater,or_less,suffix:m/s"));
318318
p_list->push_back(PropertyInfo(Variant::VECTOR3, joint_path + "gravity_direction"));
319319
}
320320
p_list->push_back(PropertyInfo(Variant::BOOL, path + "enable_all_child_collisions"));

0 commit comments

Comments
 (0)