View Single Post
Re: POD-bot back into shape.
Old
  (#114)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: POD-bot back into shape. - 10-03-2004

Actually I redid the ClampAngle() functions in a nicer way
Code:
void UTIL_ClampAngle (float *fAngle)
{
   if (*fAngle >= 180)
	  *fAngle -= 360 * ((int) (*fAngle / 360) + 1);
   if (*fAngle < -180)
	  *fAngle += 360 * ((int) (-*fAngle / 360) + 1);
}

void UTIL_ClampVector (Vector *vecAngles)
{
   if (vecAngles->x >= 180)
	  vecAngles->x -= 360 * ((int) (vecAngles->x / 360) + 1);
   if (vecAngles->x < -180)
	  vecAngles->x += 360 * ((int) (-vecAngles->x / 360) + 1);
   if (vecAngles->y >= 180)
	  vecAngles->y -= 360 * ((int) (vecAngles->y / 360) + 1);
   if (vecAngles->y < -180)
	  vecAngles->y += 360 * ((int) (-vecAngles->y / 360) + 1);
   vecAngles->z = 0.0;
}
And I added two ClampAngle() calls on idealpitch and ideal_yaw at the bottom of BotThink(), this way the assertion can't fail anymore.

I updated the podbot DLL

http://racc.bots-united.com/releases/podbot.zip
uploading now



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."