Collision's ended phase does not trigger when a physics object removed?

Can anyone clarify,

if i have one physics object move through another physics object (this is isSensor=true),

while they are touching I set the first object to slower velocity, then,

the 2nd object is removed before the firsts object has passed through,

the ‘ended’ phase does not seem to trigger.

If a physics object is removed, will it trigger an ‘ended’ phase for anything that has already triggered a ‘began’ phase with it?

Cheers.

A good question!

I seriously doubt that an object that has been removed will trigger anything but it should be relatively easy to make a test to check it.

From what I’ve understood, you shouldn’t even be able to remove a physics object during a collision event. In fact, the documentation about physics.removeBody() states that: “This call cannot be used in a collision event”.

You cannot remove during the collision, and I’m not removing the object during collision, i always have a delay of 10ms before removing, however what I want to know is, is the object being removed supposed to do an ‘ended’ phase on every object that has a ‘began’ phase with it when it gets removed.

As far as I see it is not triggering an ‘ended’ when it gets removed but logically it should (even more so if i give it a whopping 10ms to sort things out). So, just curious if it is supposed to.

Your logic is sound, but I think in terms of how the code runs, it should be impossible for the event to reach the ended phase. Since the function is trying to determine when the collision between the two objects begins and ends, it stands to reason that if one of the objects is removed, then the function is unable to determine whether an object and a nil are colliding or not because the code can’t do anything with a nil value.

Hi,

Eliminating a object during a collision without a timer is possible, the body will be automatically deleted at the end of the frame.

I think this could help: https://forums.coronalabs.com/topic/73104-finalize-event-happens-when/#entry384360

A good question!

I seriously doubt that an object that has been removed will trigger anything but it should be relatively easy to make a test to check it.

From what I’ve understood, you shouldn’t even be able to remove a physics object during a collision event. In fact, the documentation about physics.removeBody() states that: “This call cannot be used in a collision event”.

You cannot remove during the collision, and I’m not removing the object during collision, i always have a delay of 10ms before removing, however what I want to know is, is the object being removed supposed to do an ‘ended’ phase on every object that has a ‘began’ phase with it when it gets removed.

As far as I see it is not triggering an ‘ended’ when it gets removed but logically it should (even more so if i give it a whopping 10ms to sort things out). So, just curious if it is supposed to.

Your logic is sound, but I think in terms of how the code runs, it should be impossible for the event to reach the ended phase. Since the function is trying to determine when the collision between the two objects begins and ends, it stands to reason that if one of the objects is removed, then the function is unable to determine whether an object and a nil are colliding or not because the code can’t do anything with a nil value.

Hi,

Eliminating a object during a collision without a timer is possible, the body will be automatically deleted at the end of the frame.

I think this could help: https://forums.coronalabs.com/topic/73104-finalize-event-happens-when/#entry384360