7
« on: April 08, 2014, 06:09:27 pm »
It is also very possible that the first actor that kills itself executes code in the background which actually removes itself prior to the other actor executing its commands. As a result of this, if it runs that code and removes every known instance of itself from the tree, then it no longer exists in the collision list for the other actor.
Think of it in terms of this:
Bullet hits enemy.
Enemy registers collision and executes kill self command.
Engine then proceeds with the killing and removes that actor from the tree including the collision list.
Bullet now runs it's code.
Whoops bullet appears to not be colliding because the command to kill self for the enemy was executed and the killing occurred in the same frame thus removing it from the list.
I'm not 100% if that is how the engine operates, however, ideally it would work the opposite where the actual killing of itself occurred the following frame, allowing for any other references to the instance to continue executing their commands should there be any.
It's possible, that if the engine works using the former method, that it is done that way due to the limitation of a specific platform or two. I know in flash GC is done on the following frame, so it allows references like this to continue completing their tasks on the current frame.