*Try to fix a freeze bug. (atan2(0,0) returns invalid value)

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-27 13:22:21 -05:00
parent 199cac6dda
commit ba934b35d6
+2
View File
@@ -1387,6 +1387,8 @@ float WorldObject::GetAngle( const float x, const float y ) const
float dx = x - GetPositionX(); float dx = x - GetPositionX();
float dy = y - GetPositionY(); float dy = y - GetPositionY();
if(!dx && !dy)
return 0;
float ang = atan2(dy, dx); float ang = atan2(dy, dx);
ang = (ang >= 0) ? ang : 2 * M_PI + ang; ang = (ang >= 0) ? ang : 2 * M_PI + ang;
return ang; return ang;