Rotation direction move point help

Hey,



I am still sitting with this issue on my to-do queue. It comes down to some very tricky maths. You may want to use the lookAt(…) method which will point a node/spatial for you. If you take a look at Spatial.lookAt(…) the source code, you'll see it's reasonably complex with some crossing and normalizing going on.



What I need is something that will give me the X,Y and Z eular angles from location p1 with a rotation r1 to point at a given point in space p2. If you ever get to this solution, please let me know. I should have concentrated harder at school !



Good luck

Richard

wouldn't e.g. this be enough?


Node dummyPoint = new Node("I'm a silly Node"); // p1

dummyPoint.lookAt(p2.getWorldTranslation(), Vector3f.UNIT_Y);
dummyPoint.updateGeometricState();

Quaternion r1 = dummyPoint.getWorldRotation();

float[] eulerAngles = r1.toAngles(null);



Shouldn't this give you what you want?

Well I need a default pointer. Just as the cam facing as default some like it. To deal with the targeting object. To know what the object is facing in rotation. But to convert back and forward to quad and angles to deal with moving the object in the rotations. Trying to simulate the camera style into the mesh object.