- Home /
Does the position spring have no effect when a ConfigurableJoint's Angular XDrive is in position and velocity mode?
Short version of my question: is the position part of position and velocity mode of the angular xdrive broken?
Long version:
In Unity 3.10f3, I'm trying to use a ConfigurableJoint set up as a hinge joint. I have the Angular XDrive set in position and velocity mode with the position spring set at 300 and the position damper set at 5 and the max force set at .01. It appears that this mode only listens to the Target Angular Velocity and ignores the Target Rotation I set.
For example, if I set the Target Rotation to 30 degrees (after converting it to a quaternion) and set the target angular velocity at -.05 radians/s, my rigid body will continue rotating past 30 degrees until it hits the high angular x limit. The position spring doesn't seem to do anything when set to position and velocity mode. If I set the max force to 0, then the rigid body doesn't move at all. That seems to indicate that the position spring is disabled.
If I switch the angular xdrive mode to position, then the spring works. Does any one else have this problem?
Answer by Tim · Jan 07, 2011 at 04:54 PM
It looks like this configuration of the ConfigurableJoint is broken in Unity3D. I hacked up the PhysX d6Joint sample (ConfigurableJoint) and saw the target rotation and the target angular velocity both influence the attached rigid bodies.
I'll send a sample scene to support so it's hopefully fixed in a future release.
Answer by Jean-Fabre · Jan 06, 2011 at 01:34 PM
hi,
It's actually in the JointDrive helps files, the positionSpring and positionDamper "Only used if mode includes Position." It's the same for angular drives.
This should be better emphasized in the help section yes.
Bye,
Jean
Thanks for the response, but if I set the mode to position and velocity, then the mode does include position. The PhysX documentation also talks about setting both position and velocity in their section on Skeletal Animation and Ragdolls. So I'm wondering if the documentation is wrong or if there's a bug in Unity's interface to PhysX or if the bug is in PhysX.
Answer by jonas-echterhoff · Aug 25, 2014 at 11:57 AM
(Late reply, but going through old bug reports:)
As far as i can tell, this actually works as expected. If both position and rotation drives on a joint are enabled, they compete with each other for moving the joint to an angular rotation (via the spring), and keeping it at a specific velocity (which is applied via the damping). Play with those values, and you will see that one or the other of them will "win".