I am trying to move a object to it's destination (both represented by Vector3) at a constant speed.
Setup:
destination = gkVector3(1.0f, 0.0f, 1.0f);
myObj = gkVector3(0.0f, 0.0f, 0.0f);
velocity = 0.1;
Loop:
gkVector3 direction = destination - myObj;
myObj = myObj + direction * velocity;
if(myObj == destination) {
gkPrintf("THE SAME!!!!");
}
Then, I want to check if the object has reached it's destination. If yes, a message will be showed. When velocity is set to 1.0, there is no problem at all; but when I set the velocity for example to 0.1 the object will never reach it's destination and the message will not be showed. So, how can I move an object precisely to it's destination at a constant speed?
*gkVector3 represents Ogre3D Vector3