Physics Engine Insanity

All This needs to be cleaned up Trying to figure out the approved way to use the physics engine. There are some conflicting pages out there:

Objects in Display Groups:

can use them, don't need in same container. however, you can't move/ change their position towards each other. that changes the coordinate system.

Objects in Display Groups:

"Physics bodies all need to be in the same group"

"I have items from two groups collide all the time. What I have found is that if you assign x and y values to your groups, however, the collision system fails between those groups. Seems the collision detection relies on checking object coordinates against each other and when you assign group x,y values you localize the object coordinates to different origins, so according to the system the objects do not overlap."

"However, unexpected results may occur if physical objects are added to different display groups, especially if the groups are then moved in different directions."

Display Groups As objects:

you can't use display groups as objects

this project (i also saw on youtube ) uses display groups. however, they must be constructed in a special manner. (i tried it and couldn't get my objects to show up.

Defining shapes

box 2d says counter clockwise.

Shape definitions should declare their points in clockwise order

(it seems like all of the examples are showing counter clockwise, but saying clockwise )

custom shapes must have less than 8 sides - or be composed of multiple shapes.

Physics Stop

"Trying to figure out a workaround that let me still use physics.stop() and the only one that seems to work is to be super-anal about removing EVERY SINGLE object used in the simulation before calling physics.stop()."

Proper startup / Shutdown Method

"call physics start before adding objects"

MOdifying world during collisions

set timer during collisions


solutions to common problems

My Issues i had a ghost collision situation - i would launch my character, and it would automatically collide with something. and the screen would go black. traced it to the fact that i was passing in the same data structure to define a custom physics shape.