oakes / play-clj

A Clojure game library
The Unlicense
939 stars 73 forks source link

Box2D physics bodies not always destroyed when expected #101

Open the2bears opened 8 years ago

the2bears commented 8 years ago

I'm not sure how serious this bug is, because there would usually be "something happening" on the screen.

However, Box2D physics bodies are destroyed when their respective entity is removed from entities in the update-physics! function. This is called from update-screen! which (I think) only gets called if something has changed.

I ran into a situation, during testing, where the entity is removed but no other changes needed to be rendered. The "bullet" in question disappeared as its entity was removed, but the physics body still rendered (due to a debug renderer) and still affected other bodies. Once I "moved" something on the screen, the above functions were triggered and the body was properly destroyed.