godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.71k stars 21.12k forks source link

In the PhysicsServer2D, at enum DampedSpringParam description for DAMPED_SPRING_DAMPING it states the default is 1.5, but it's 1 #81591

Closed Ughuuu closed 1 year ago

Ughuuu commented 1 year ago

Godot version

4.2

System information

Macos with m1

Issue description

In the class PhysicsServer2D at enum DampedSpringParam, the description for the enum value DAMPED_SPRING_DAMPING is:

● DAMPED_SPRING_DAMPING = 2
Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping).
The default value of this parameter is 1.5.

However it seems that the default value for damped spring damping is 1, not 1.5.

Steps to reproduce

Read documentation of PhysicsServer2D.damped_spring_joint_set_param and go to DampedSpringParam.

Minimal reproduction project

N/A

timothyqiu commented 1 year ago

The default value is 1.5 in the physics server. What you're referring to is the default value of the DampedSpringJoint2D node.

https://github.com/godotengine/godot/blob/3ed4497113fa10611b90290ce22a751fb9d26e2e/servers/physics_2d/godot_joints_2d.h#L155

https://github.com/godotengine/godot/blob/3ed4497113fa10611b90290ce22a751fb9d26e2e/scene/2d/joint_2d.h#L126

Ughuuu commented 1 year ago

Interesting, thanks. Do you know where that value of 1.5 is used at?

AThousandShips commented 1 year ago

For manually created springs, using joint_create + joint_make_damped_spring

These discrepancies between the node types and the server types can be confusing, but they can't be changed because they would break compatibility, and they are documented (largely) so they are clear