1

I know how to make an axis-aligned prismatic joint using the ConfigurableJoint. For a prismatic joint along the x axis, I can do the following:

ConfigurableJoint joint;
joint.angularXMotion = ConfigurableJointMotion.Locked;
joint.angularYMotion = ConfigurableJointMotion.Locked;
joint.angularZMotion = ConfigurableJointMotion.Locked;
joint.angularYMotion = ConfigurableJointMotion.Locked;
joint.angularZMotion = ConfigurableJointMotion.Locked;
joint.axis = Vector3.right;

Other axis-aligned joints are similarly easy. However, what if I want to make a prismatic joint along the axis, say, (1/sqrt(3), q/sqrt(3), 1/sqrt(3)). Is there a way to make this happen?

user650261
  • 2,115
  • 5
  • 24
  • 47

1 Answers1

0

The X,Y,Z properties (like xMotion, angularYMotion, etc.) don't refer to the X,Y,Z axis of the world space or object space coordinates. They refer to the joint's own coordinate system that you define with axis and secondaryAxis:

  • The axis property defines the joint's X axis
  • The secondaryAxis defines the joint's Y axis
  • The joint's Z axis is calculated from X and Y

So basically, you just have to define the X axis your want:

joint.axis = new Vector3(x, y, z); // defines the X axis, relative to the object's space
KeatsPeeks
  • 19,126
  • 5
  • 52
  • 83
  • (I will check this soon, but I wanted to give you a bounty since it looks like this might clear up my understanding and you're the only person to actually reply) – user650261 Feb 07 '18 at 22:15