notgiven688/jitterphysics2

Rigid Body damping is reversed

RonenNess opened this issue · 3 comments

Hello,

Aside for this issue #53 , the damping values themselves are also seems to be reversed.

This means that damping value of 0 completely stop the objects from moving (what should happen with damping value of 1) while damping value of 1 actually let the objects move forever (what should happen with 0).

In other words, I need to set damping like this in order for it to behave like in other physics simulators:

rigidBody.Damping = (1f - actualLinearDamping, 1f - actualAngularDamping);

Is that intentional? I checked with few other engines and there seems to be a consensus that 0 = no damping, 1 = 100% damping, and sometimes negative value increase movement.

Thanks!

Hello!

Interesting point. This was intentional - the documentation-tag says:
"Specifies the damping factors. The angular and linear velocities are multiplied by these values at each step. "

Applying this rule results in a "damped" movement of the (free) body x(t)=A*exp(-lambda*t), where lambda is given by (1-jitters_damping_factor). One could argue that lambda is the more natural choice for "Damping".

I will think about reversing the definition as you suggested.

Hi thanks for the consideration and for making this engine!

I don't know how much you count it as legit opinion but here's how chat GPT defines damping (question was: "how damping in a physics engine works? what does a damping value of 0 means?"):

Damping in a physics engine is a technique used to reduce the velocity or oscillation of objects over time. It is often applied to simulate the effects of friction, air resistance, or other dissipative forces in the virtual environment. Damping helps stabilize simulations and prevents objects from continuing to move indefinitely.

In the context of a physics engine, damping is typically implemented as a velocity-based force opposing the motion of an object. The damping force is proportional to the velocity of the object, and its goal is to gradually reduce the object's velocity until it comes to rest.

The damping effect can be controlled by a damping parameter or damping coefficient. This parameter determines how quickly the damping force is applied. A damping value of 0 means no damping, indicating that there is no force acting to slow down the object's motion. As the damping value increases, the damping force becomes stronger, causing the object to lose velocity more rapidly.

In summary, a damping value of 0 means no damping effect, and the object will continue moving without any resistance. Higher damping values introduce resistance, causing the object to lose velocity over time. The exact interpretation of the damping value may vary between different physics engines, so it's essential to refer to the documentation of the specific engine you are using for precise details.

Fixed the reversal.