Rotate a skeleton bone to look into specific point

I’ve stumbled on possible easy to solve problem with quaternions.


  • I’ve got skeleton with a specific bone (e.g. “bone”)
  • The bone has it’s modelSpace position, rotation, scale
  • I’ve got other point in space (specifically tail point of an other bone e.g. “trackedBone” in the same skeleton)


  • I would like to rotate a “bone” to point to this specific point in model space (simple trackTo constraint)

I was trying to get vector which define desired direction in world space:

Vector3f vec = trackedBone.getModelSpacePosition().subtract(bone.getModelSpacePosition());

then i have to create Quaternion q in order to apply it on setUserTransforms:

bone.setUserTransforms(Vector3f.ZERO, q, Vector3f.UNIT_XYZ);

And with this I have problem. Using Quaternion.lookAt() gives rotation regarding base position in Cartesian system but not for bone, which is located specifically in modelSpace e.g.

q.lookAt(vec, Vector3f.UNIT_Y);

I’m not so good with quaternions yet. Anyone has got some advices ?