Page 1 of 1

Angle not normalized?

Posted: Fri Jun 28, 2013 1:32 pm
by bram
So, every once in a while, a body in my simulation will have an angle that is not normalized.
For example, a case here:

Image

I would expect cpBodyGetAngle() to return a value between -pi and +pi

Now granted, I set the angular velocity of the body (with circle shape) each frame.
But surely this should not lead to non normalized angles?

Is this a bug?

Re: Angle not normalized?

Posted: Fri Jun 28, 2013 2:27 pm
by slembcke
Nope, it's intended behavior. I used to normalize the angle, but it prevented a lot of things. Angular constraints of more than a full revolution were not possible, gear joints weren't possible for instance. A lot of math is just obnoxious when you have to deal with cyclic differences. You couldn't count the number of revolutions that an object spins... etc etc etc

Overall, there just was little to no reason to continue normalizing it and many reasons not to.

Re: Angle not normalized?

Posted: Fri Jun 28, 2013 8:06 pm
by bram
Thanks Scott,
That makes sense, I understand.