Commander McLane wrote:El Viejo wrote:I love the way you say 'simply' McLane... at my age, only falling over is simple.
You note that I left the moniker out in the quaternions part.
And even that is simple when using the console to do the calculations for you. Just type:
Code: Select all
Vector3D(x, y, z).direction().multiply(-1).rotationTo(Vector3D(0,0,1))
x, y, z are the 3 coordinates you used in the position. This will give a quaternion pointing to the centre of the ship. When you don't want to look to the centre but to a specific other point you need:
Code: Select all
Vector3D(x2, y2, z2).subtract(Vector3D(x1, y1, z1)).direction().rotationTo(Vector3D(0,0,1))
Point 1 is were you looking from and point 2 is were you looking at. This resulting vector must be transformed to a unit vector with the
direction()
method
No need to understand the math in it, just type it in the console and use the result you get.
(It could be that rotationTo() has a bug. At least something this function relied on had a bug that is fixed in the current nighties)