Closed Skeletonxf closed 7 years ago
I merged this but I don't remember if I left the .world variable out on purpose or not. I think I had an unwritten rule somewhere that you weren't supposed to try to destroy physics objects from within the collision callbacks, but I don't remember if I fixed this somehow or not. But I guess if it works for you it works. If you find any more bugs related to deleting the physics object from inside the callbacks please let me know.
Ah that could make sense, as some of my entities would have been destroyed during collision callbacks (the player bullets would be destroyed after a fixed time, and the enemies would be destroyed when hit by a bullet), but the error was incredibly infrequent.
This commit calls a.world only after it is not null, as I was running into errors when deleting various bodies when the callback still tried to access the
world
of a nil variable. I then saw theif a and b
check a few lines down and as far as I can tell moving the world access after this check removed the error.