I've read a couple of very helpful threads here on Quaternions, so I decided to try putting them to use. I was able to use them to move a 3D object around using a modification of Riemer's flight simulator tutorial, to which I added a second object.

However, I then tried to initialize the orientation of the two objects to point towards each other from any given starting location, and that didn't work the way I expected. Can someone help me understand what's wrong with the following code

public void SetOrientation(Vector3 startLocation, Vector3 targetLocation)

{

Matrix target = Matrix.CreateLookAt(startLocation, targetLocation, Vector3.Up);

Orientation = Quaternion.CreateFromRotationMatrix(target);

}public virtual void Update(GameTime time)

{

float distance = time.ElapsedGameTime.Milliseconds * Speed;

Vector3 move = Vector3.Forward;

move = Vector3.Transform(move , Matrix.CreateFromQuaternion(Orientation));

move .Normalize();

Position += move * distance;

}

I'm calling GetOrientation with a start location of (-3, 3, 0) and a target of (3, -3, 0). I expected the Update call would then move the object towards the target. Instead, the object moves along the X axis -- its X value continues to decrease while Y and Z remain the same.

Any help is much appreciated!

Tom