Thanks Genetransfer.
However, I don't understand one of the parameters of iQuaternionlookAt:
iQuaternionLookAt(Quaternion,Vector3,Vector3)
Quaternion = resulting quaternion. Return data.
It is the rotation required to orientate the Z+ vector
D3DXVECTOR3(0.0f,0.0f,1.0f) to the specified direction.
Vector3 = direction
Vector3 = up direction. For example Vector3(0,1,0)
NOTE: this function will not work properly if 'direction' and 'up'
vectors are parallel.
What is the Vector3 = direction?Would it be the vector after I subtract the 2 location vectors and set it using iVectorLengthSet()?
I'm not very familiar with quaternions and vectors so...
Thanks
--PlayDasher--
the direction is (origin-target), yeah without a code showing it in action it's not obvious what should go there.
so...(below is untested but shows the use of iQuaternionLookAt() in this context)
Vector3 accelerationDir = Vector3(0.0f,0.0f,1.0f);//set to 1.0 on z every loop (also can't remember if you can set Vector3's like this)
float acceleration = 1.0f;//or whatever force you want to apply.
iVectorLengthSet(accelerationDir ,accelerationDir ,acceleration);
Quaternion qLookAt;
Vector3 vUp = Vector3(0.0f,1.0f,0.0f);
Vector3 Origin = The location of object that will accelerate toward target
Vector3 Target = the location of the target
iQuaternionLookAt(qLookAt,(Origin-Target ),vUp );//if accelerates away from target swap it (Target-Origin) can't remember which is first)
iVectorRotate(accelerationDir,accelerationDir ,qLookAt);//orientate the acceleration vector to look at the target
iObjectAccelerationApply(OBJ_X,accelerationDir);//apply acceleration