Hi Erin,
In playing with compound shapes I noticed that if I build a body with 2
circles I can get the world position of both with shape->GetPosition().
However if I use a circle and a box the circle position is ok. But the box
position seems to be reported as right in the middle of both shapes.
Is that normal behavior?
Thanks!
Mike
Yes, this is normal. Boxes are converted into polygons and polygons have all their vertices resolved into the body's coordinate frame. This is a performance optimization.
Normally games do not use shape positions for simulation. They take the body position and move the sprite, bone, etc accordingly. Games do not normally render the exact shape, the shape is just an approximation of the model. For example, games like Mario just wrap a box or capsule around the character. They don't have every pixel represented by the collision shapes. Therefore, the shape positions are not used (except perhaps for debug drawing).
Remember that shapes are completely fixed to the body. The relative position of a shape on a body is not changing.
Normally you should not need to access shapes in your game loop. In the test bed I work with shapes because I don't have a full game engine with sprites, bones, etc.
Ah I see! Thanks for clearing that up!
So shapes should always be invisible ..just show the body in the game..
Got ya!
Thanks again Erin for an amazing lib.
Mike