Damned Quaternions :..-(

Sorry for bothering you with plain mathematical problems, but i just don't get it working… in jME.







I have 2 nodes A and B.



B is attached to A, both have the same location (means B has localTranslation 0,0,0)



How can i get B to face a certain point no matter A's rotation?

I know, quaternions. But here is the problem.



I composed a quaternion with the WorldLocation vector and the world vector to the point i want to face with B.

(Let's say a quaternion that represents an angle of 90

Have you looked up the lookup() method of Node ( or is it spatial );



look up the look up …

You mean lookAt(), I guess. Yes that will help when the point to look at is converted to local coordinate space first. Spatial.worldToLocal can do that for you.

to get the axis to rotate from a to b: a.cross(b).normalize()

angle between vectors: a.normalize().dot(b.normalize())



the quaternion:

Quaternion q=new Quaternion;

q.fromAngleAxis( a.normalize().dot(b.normalize()), a.cross(b).normalize())