ivansafrin/Polycode — Issue #67: addPhysicsChild w/ENTITY_CIRCLE breaks on ovals
Author: mcclure
Created: 2011-12-15 02:44:25+00:00
State: open

Running this exact version of my test program https://bitbucket.org/runhello/polyconsole/changeset/99b5775b57b6

I create a 2D physics space. I add to it a series of circles and also a series of ovals (both ScreenShape::SHAPE_CIRCLE). I addPhysicsChild them as ENTITY_CIRCLE.

This happens:

http://i.imgur.com/3uUaJ.png

In other words the circles behave with correct physics and the ovals behave as if their "physics entity" was a circle either smaller or larger than the circle itself. What it LOOKS like is that the WIDTH of the ScreenShape::SHAPE_CIRCLE is being used to determine the radius of the "physics" ENTITY_CIRCLE.

Now, probably it is a limitation of Box2D that you can't have an ovular circle, or this is just the behavior of ENTITY_CIRCLE (you asked for a circle, you got a circle). BUT if this is the case then I feel this behavior should be documented:

http://polycode.org/docs/physics2d/class_polycode_1_1_physics_screen.html#a2ffc2231336057670450be2ba1a48660

In general I feel it would help if the exact meaning of ENTITY_RECT and ENTITY_CIRCLE were better defined here. For example, what if I add a ScreenImage as an ENTITY_CIRCLE physics child? The documentation does not make it clear.

Also, I think that since polycode/ScreenShape supports ovular circles fine, it might make sense to have some way of adding the oval-circles to a physics space.