Ghost bodies after release
Posted: Wed Aug 03, 2022 6:52 pm
Hello,
I am trying to build a small physics-based game, and at some point I need to convert a kinematic body to a dynamic body.
I also need to move the center of mass, and then also shift all shapes. All things considered, it appeared simpler to basically create a fresh body with a fresh collection of shapes and fixtures, just copying what I needed.
Then I call release on each old fixture, each old shape and the old body, and overwrite the references to them.
That seemed to work well until I realized the old body turned ghostly and still cause collision.
Since I don't have any reference to the old objects, I suppose the world object have.
How am I supposed to clear these objects properly?
The only thing I found searching for this problem was to call destroy, which have been removed long ago.
I am trying to build a small physics-based game, and at some point I need to convert a kinematic body to a dynamic body.
I also need to move the center of mass, and then also shift all shapes. All things considered, it appeared simpler to basically create a fresh body with a fresh collection of shapes and fixtures, just copying what I needed.
Then I call release on each old fixture, each old shape and the old body, and overwrite the references to them.
That seemed to work well until I realized the old body turned ghostly and still cause collision.
Since I don't have any reference to the old objects, I suppose the world object have.
How am I supposed to clear these objects properly?
The only thing I found searching for this problem was to call destroy, which have been removed long ago.