That method doesn't take into account Image's rotation (I will try to clarify in docs).
Instead, use the Slick polygon as your renderable shape -- but create it upright and at (0, 0). When it comes time to render the shape, do something like so:
1 2 3 4 5 6 7 8 9 10 11
| g.translate(bodyX, bodyY);
g.rotate(polyCenterX, polyCenterY, bodyRotation);
g.texture(..);
g.rotate(polyCenterX, polyCenterY, -bodyRotation); g.translate(-bodyX, -bodyY); |
Notice that this doesn't actually change the Slick Polygon at all; it remains static and is only used for rendering.
Some things to consider:
- Phys2D expects rotations in radians, Slick expects rotations in degrees
- Phys2D's positions are based on the center of the shape, Slick's positions are based on the top-left of the shape
- If you are using the Slick Polygon for collision, you won't get accurate results since it will always be (0, 0) and upright (zero rotation). So you should only rely on Phys2D for collision.