Hi,
Having a problem with some box2d returns for a game on the iPhone.
For the actors in the game world, I need to know their degree of rotation (0-360) and am using
(the RADIANS_TO_DEGREES is #define RADIANS_TO_DEGREES(__ANGLE__) ((__ANGLE__) / M_PI * 180.0) )
This is returning unexpected results. I start at 0, and as the body rotates clockwise, the values increase to 360 with one rotation. From then I pass this and get 361,362,363, etc. Anticlockwise I get -1, -2, and so forth.
How to I return a strict value from 0-360, am I missing something obvious?
Thanks in advance.
Having a problem with some box2d returns for a game on the iPhone.
For the actors in the game world, I need to know their degree of rotation (0-360) and am using
Code: Select all
float angle = RADIANS_TO_DEGREES(Body->GetAngle());(the RADIANS_TO_DEGREES is #define RADIANS_TO_DEGREES(__ANGLE__) ((__ANGLE__) / M_PI * 180.0) )
This is returning unexpected results. I start at 0, and as the body rotates clockwise, the values increase to 360 with one rotation. From then I pass this and get 361,362,363, etc. Anticlockwise I get -1, -2, and so forth.
How to I return a strict value from 0-360, am I missing something obvious?
Thanks in advance.