Hello.
I have a contact listener. From the BeginContact method I try to remove a body which I no longer need, but the problem is that that body is locked and an assertion is triggered.
How can I properly remove a body from within a BeginContact callback? What is the best approach?
I use world->DestroyBody(body) to destroy the body.
Thanks.
PS: If I comment out the line with "assert" and "if (islocked) return" it works exactly as I want it, but I prefere coding my games without modifying the framework. I'm sure the author had a very good reason for the "locked" thing.
I have a contact listener. From the BeginContact method I try to remove a body which I no longer need, but the problem is that that body is locked and an assertion is triggered.
How can I properly remove a body from within a BeginContact callback? What is the best approach?
I use world->DestroyBody(body) to destroy the body.
Thanks.
PS: If I comment out the line with "assert" and "if (islocked) return" it works exactly as I want it, but I prefere coding my games without modifying the framework. I'm sure the author had a very good reason for the "locked" thing.