The Angular Drive Damping property seems to behave unusually in a constraint.
- Linear limits all locked.
- Angular limits all free.
- A single physics driven static mesh actor as Constrained Actor 1.
- Enable Angular Orientation Drive.
- Set Angular Drive Spring to 100 or something fitting the referenced mesh’s weight.
- Leave Angular Drive Damping on 1.
- Start the game and nudge the mesh. Observe how springy it is, it will oscillate for a while.
- Change Angular Drive Damping to 0 then to 100 or 100000. The constraint’s behavior won’t change.
- Disable Angular Orientation Drive and enable Angular Velocity Drive.
- Set Angular Velocity Target to (0,0,10).
- Set Angular Drive Force to 1000.
- Set Angular Drive Spring and Angular Drive Damping to 0.
- Start the game. The mesh doesn’t spin.
- Set Angular Drive Force to 0.
- Angular Drive Damping to 100.
- Start the game and notice that the mesh is revolving now.
Something is fishy here, right?
The problem you’re running into is due to the UI being misleading. I’m actually going to fix this right now, but first I’ll answer your question.
The damping of the spring is only used when velocity drive is turned on. Similarly, the stiffness of the spring is only used when the position drive is on. So in Issue 1 you would need to turn Angular Velocity Drive on to see the effects of damping.
In issue 2 there is actually a different problem, which is that we use 0 to mean no limit. I think this is not a good approach and am having an internal discussion about changing this to having something more explicit.
Sorry about this I know it’s not ideal. As a reference, the formula used by the motors is this:
force = spring * (target position - position) + damping * (targetVelocity - velocity)
Hope that helps, let me know if you still have questions.
I’m not sure but there might be some confusion here still.
According to the PhysX docs (https://developer.nvidia.com/sites/default/files/akamai/physx/Manual/Joints.html) the formula you mentioned is for linear drives. For angular drives “damping - applied to the drive spring (used to smooth out oscillations about the drive target)”.
While it is weird that one time damping is related to velocity then to spring, it does make sense to have a parameter to tweak oscillation.
And yes, “0 = INF” is bad usability, I should have remembered that one from UDK times… Maybe under the hood you could replace 0 with 0.000001 or something when feeding PhysX and let the user just type in 999999 for very big forces.
And while we are at it, I’m not sure if it still works like that but back in the day there were some nasty, undocumented value processing like where one could not have a swing/twist limit angle less than 5 degrees or where spring/damping value of 0.1 was rounded to 0. It would be great not to have those this time around.
Thanks for looking into it.
Thanks for the link. My interpretation of this documentation is that the rotational part is different in that you can use SLERP or angular vs twist to determine the error in position and velocity. However, I believe that the overall spirit of the linear formula still applies in that they calculate an error (position or velocity) and then multiply it by some strength coefficient.
If you turn on damping without any spring strength and use angular velocity set to true you’ll see the object still moves. This would not be the case if it was a traditional spring like the ones used in PhAT for example.
I will double check with NVIDIA to make sure, thanks for bringing it up.
UPDATE: I just had a quick chat with NVIDIA about this and they confirm this interpretation. Please let me know if you run into any more issues