How Do I Keep The Angle Of A Body In Pybox2d Between -pi And Pi?
In the pybox2d manual it states the following: pybox2d uses radians for angles. The body rotation is stored in radians and may grow unbounded. Consider normalizing the angle of
Solution 1:
Looks like the library has been pythonized since those docs were written. angle is a property of Body:
@angle.setter
defangle(self, angle):
self._xf.angle=angle
self._transform_updated()
You should be able to simply set it with something like:
defupdate_outputs(self):
# This is necessary to prevent the angle# from getting too large or smallself.body.angle %= 2*pi
Post a Comment for "How Do I Keep The Angle Of A Body In Pybox2d Between -pi And Pi?"