I'm struggling with an issue where the x position of my object moves quicker than the z position, or vice versa. How can I make my object slow down for the x position if the z position requires more time to move?
This is the code in my animation function:
var distanceX = objectX - targetX;
var distanceZ = objectZ - targetZ;
if( distanceX < 0) {
visitor.translateX( 0.05 );
}else {
if( distanceX > 0) {
visitor.translateX( -0.05 );
}
}
if( distanceZ < 0) {
visitor.translateZ( 0.05 );
}else{
if( distanceZ > 0) {
visitor.translateZ( -0.05 );
}
}