Hello,
I am trying to program an entity to slowly rotate towards an object. I did the following below, which works, but it doesn't account for the fact that if the entity is facing lets say 355 degrees, and it needs to rotate to 5 degrees to point towards object, it goes all the way around the long way to get there. Here is what I have:
Code:
vec_set(vTarget_Temp,your.x); 
vec_sub(vTarget_Temp,my.x);
vec_to_angle(vTarget_Angle,vTarget_Temp);
if(my.pan > vTarget_Angle.x)
{
	my.pan -= time_step;
	//if((my.pan - vTarget_Angle.x) > 180){my.pan += time_step;}
	//if((my.pan - vTarget_Angle.x) <= 180){my.pan -= time_step;}
}
  				
if(my.pan < vTarget_Angle.x)
{
	my.pan += time_step;
	//if((my.pan - vTarget_Angle.x) > 180){my.pan += time_step;}
	//if((my.pan - vTarget_Angle.x) <= 180){my.pan -= time_step;}
}
  				
wait(1);


You can see the commented out stuff that I was trying to do, but it just was not working right. Any ideas?


NATIO Released! Check it out at http://mahonroy.home.comcast.net/natio.htm -Matt AMD 1.2 Ghz Thunderbird 512 Meg Ram GeForce 2 Ultra 64 Meg DDR Using A5 Professional