Hello,
first of all, this engine is a great achievement!
I am having a bit of an issue I dont know if I am handling well.... and I would like some suggestions or help.
When I destroy a body during a collision (that is, AFTER the physics Step(), because I buffer collisions and process them afterwards as suggested), Box2D creates a callback to "b2ContactListener::Remove()", which I buffer. BUT, I get corrupted data (0xfdfd) in USER data. This is because Box2D, in DEBUG mode, sets all deallocated memory to 0xfd to see errors.
Now my question: How should I process the "contact deleted" collision event, due to a body destruction? In the user data I store a pointer to my agent class of a game, which will handle the collision event properly. So, If I destroy the body with some user data, I will always receive events with 0xfdfd in user data... I dont know how I should manage it properly.
(note: I dont have this problem in Release modes, as Box2D doesnt write 0xfdfd , and bodies destroy correctly, I handle the collision callback properly without dangling pointers...)
Thank you for your help!
first of all, this engine is a great achievement!
I am having a bit of an issue I dont know if I am handling well.... and I would like some suggestions or help.
When I destroy a body during a collision (that is, AFTER the physics Step(), because I buffer collisions and process them afterwards as suggested), Box2D creates a callback to "b2ContactListener::Remove()", which I buffer. BUT, I get corrupted data (0xfdfd) in USER data. This is because Box2D, in DEBUG mode, sets all deallocated memory to 0xfd to see errors.
Now my question: How should I process the "contact deleted" collision event, due to a body destruction? In the user data I store a pointer to my agent class of a game, which will handle the collision event properly. So, If I destroy the body with some user data, I will always receive events with 0xfdfd in user data... I dont know how I should manage it properly.
(note: I dont have this problem in Release modes, as Box2D doesnt write 0xfdfd , and bodies destroy correctly, I handle the collision callback properly without dangling pointers...)
Thank you for your help!