- Home /
How does ConfigurableJoint's TargetRotation works?
Hey guys, I'm trying to rotate a physics object through user input. I want the object to rotate instantly, but I don't want to set its rotation directly, because this will cause physics problems, like objects falling through. Since I also use the configurable joint to keep the object in place (its linear movement is locked), I want to use the TargetRotation property of the configurable joint. But to whatever I set it, it just doesn't rotate the object in any way.
How does this thing work? Does anyone has more info about it than the single line found in the docs?
Answer by skovacs1 · Oct 07, 2010 at 08:31 PM
When the script reference doesn't yield answers, I check the reference and user manuals. Here's the much more thorough docs on how to use a ConfigurableJoint.
After a quick read of the section on rotation, I would ask, "did you properly setup the rotational acceleration?" This would be either the two angularDrives or the slerpDrive as defined by the rotationDriveMode.
Movement/Rotation Acceleration
<p>You specify object movement or rotation in terms of moving the object toward a particular position/rotation, or velocity/angular velocity. This system works by defining the "Target" value you want to move toward, and using a "Drive" to provide acceleration which will move the object toward that target. Each "Drive" has a Mode, which you use to define which "Target" the object is moving toward.</p>
<p>...</p>
<p><strong>Rotation Acceleration</strong></p>
<p>Rotation acceleration properties: Angular XDrive, Angular YZDrive, and Slerp Drive function the same way as the translation Drives. There is one substantial difference. Slerp Drive behaves differently from the Angular Drive functionality. Therefore you can choose to use either both Angular Drives or Slerp Drive by choosing one from the Rotation Drive Mode. You cannot use both at once. </p>
Thanks for pointing that out skovacs1. With some trial and error it now works. I'm happy.