This PR mainly adds support for offset to BoxShapes by extending them from Poly instead of Shape.
This is basically what is happening in chipmunk too. cpBoxShapeNew is just a helper function calling cpPolyShapeNew and ignoring the offset.
Additional changes in this PR:
Added an offset property with a getter to Poly.
Removed the unused radius parameter fromPoly.create_box and use the offset argument in the Poly constructor call.
Added a bit of the pymunk docstring for the Shapes friction property. Sorry for this unrelated change, but imho that is a really good piece of information to have there.
The only two cases i can thing of which might break due to this changes are:
If someone used the (unused) radius argument of Poly.create_box
Code like this:
if isinstance(shape, Poly): # Would now match for BoxShapes, while it wouldn't before
do_something()
elif isinstance(shape, BoxShape)
do_something()
This PR mainly adds support for offset to
BoxShapes
by extending them fromPoly
instead ofShape
. This is basically what is happening in chipmunk too.cpBoxShapeNew
is just a helper function callingcpPolyShapeNew
and ignoring the offset.Additional changes in this PR:
offset
property with a getter toPoly
.radius
parameter fromPoly.create_box
and use theoffset
argument in the Poly constructor call.The only two cases i can thing of which might break due to this changes are:
radius
argument ofPoly.create_box