Rotate about a axis not draw from origin

hi,



I want to have a spatial rotate about a axis, and I do the following code:


      SpatialTransformer st = new SpatialTransformer(1);
      Quaternion x180 = new Quaternion();
      x180.fromAngleAxis(FastMath.DEG_TO_RAD * 180, new Vector3f(0, 0, 1));
      pivot.addController(st);
      rootNode.attachChild(pivot);
      st.setRotation(0, 2, x180);



In line

      x180.fromAngleAxis(FastMath.DEG_TO_RAD * 180, new Vector3f(0, 0, 1));



what I got is a rotation about the z axis, but I want to have a rotation about a parallel line of z axis but not z axis itself.

Do you guys know how to do a rotation about a vector not start from origin?
ansonn wrote:
Do you guys know how to do a rotation about a vector not start from origin?
Yes, but if we tell you ...will you really learn anything?

Okay.  :|

Rotations are always done around an axis, the axis can be x,y,z or an arbitrary axis.

I think to get the object to rotate in the way you're asking, you have to translate to the axis of rotation, rotate, then translate back. That should achieve the rotation you want.