- Home /
Joint: Swing & Twist?
Hi! I'm using a configurable joint's angular x drive, velocity mode.
The documentation say sthis about the angularXDrive:
Only used if Rotation Drive Mode is Swing & Twist.
What is Swing & Twist and how do I use it? I havn't found and documentation about this.
I'm making a dragable door, but the door never moves even if it has a target velocity and position spring.
Thanks!
Cheers
Answer by aj-nolan · May 24, 2018 at 03:26 AM
This is an old question, and I'm not one to often necro, but given the number of folks following and the number of people that may land here in the future I thought this answer warranted. The documentation around this is indeed lacking. What I have found (largely from trial and error) is that "swing and twist" refers to RotationDriveMode.Slerp
.
When configuring your joint be sure to setup the rotation drives like so:
joint.rotationDriveMode = RotationDriveMode.Slerp;
joint.angularXMotion = ConfigurableJointMotion.Free;
joint.angularYMotion = ConfigurableJointMotion.Free;
joint.angularZMotion = ConfigurableJointMotion.Free;
joint.angularYZDrive = new JointDrive
{
positionSpring = strength,
positionDamper = damper,
maximumForce = maxForce
};
joint.angularXDrive = new JointDrive
{
positionSpring = strength,
positionDamper = damper,
maximumForce = maxForce
};
Be sure to replace strength, damper and maxForce with values that make sense for your use case.
Lastly a brilliant breakdown of configurable joint can be found here.
Your answer
Follow this Question
Related Questions
Using a ConfigurableJoint to move an object to a postion and rotation. 0 Answers
controlling the target rotation of a configurable joint via input? 1 Answer
"bleeding" when using configurable joints 2 Answers
Joints Configured from Script do not work properly? $20 reward 3 Answers
Difference between creating Configurable Joint in code and creating the same type of Joint in script 1 Answer