How do I remove drag from the system completely?
A: you cannot remove "drag" completely with the current version of Newton. however, you can remove a significant amount of drag by calling the NewtonBodySetLinearDamping and NewtonBodySetAngularDamping functions, with a value as low as 0.0001.
- note: the default for these functions is a value of 0.1, so setting it to a lower value will greatly reduce the amount of drag in your scene.
Q: Why is it limited to 0.0001? Why can't it be set to zero?
A: (from official Newton forums, user Julio Jerez)
That is not so simple. When dealing with constrained dynamics it is not the integration of the body dynamics, you need to take into account the reaction forces between joints and contacts. Those force are non linear and a very small amount of extra energy added to the system lead to vibration.
Many physics engine do not have that problem as bad as Newton because the reaction forces are calculated as an approximation by and interactive process. But in Newton this is not the case. Let me give you and example: Take for example a simple pendulum the centripetal acceleration need to maintain the orbit is given by:
A = V * V / R A = acceleration; V = velocity; R = radios
This is the acceleration that the that the solver will calculate, however when this causality is integrated by a simple Euler integration, both the radios and the velocity changes by some amount, in the next step what you have is
A1 = (v + dv) * (v + dv) / (R + dR)
Now there is a problem because the pendulum will drift out of course To correct the problem a spring and damper is added to the system The equation change to:
A1 = (v + dv) * (v + dv) / (R + dR) – K * Vr – K * dR
Vr is the velocity along the radios
But this spring and damper are a source of extra energy added to the system and need to be substrate before the system gains some much energy that go out of control and explode.
There are certainly better integration method than a simple Euler, even a modified Euler in much better, however all those method required that calculation of the forward or backward derivatives (the acceleration), also all integration methods assume the derivatives are smooth along the trajectory (which is highly no the case when contact happens) The implementation of any other integration method (RK2 for example)will require at least two scenes updates assuming no collision, and backtracking if collision happens.
I still do not understand why a drag value of 1.0e-4 is so important to you, can you just add a small force to compensate for that. In the update callback normalize the velocity vector and add a force proportional the lost in velocity. I do no recommend doing that on linked objects.
back to the FAQ