A question about collision detection

Guys lets say i have two objects.

A pie, and a plate.

When detecting a collision between then, this conditional would mean the some thing?

event.object1.name == ‘pie’ and event.object2.name == ‘plate’

event.object1.name == ‘plate’ and event.object2.name == ‘pie’

?

Hi @decaobr,

They’re not quite the same. When using “global” collision listeners, the behavior is essentially that “object1” is the first object that was given a physics body. In contrast, “local” collision listeners give you “self” and “event.other” parameters, where “self” is the object with the listener applied, so you know exactly which one it is, while the other object is the one it collides with.

Hope this helps,

Brent Sorrentino

Hi @decaobr,

They’re not quite the same. When using “global” collision listeners, the behavior is essentially that “object1” is the first object that was given a physics body. In contrast, “local” collision listeners give you “self” and “event.other” parameters, where “self” is the object with the listener applied, so you know exactly which one it is, while the other object is the one it collides with.

Hope this helps,

Brent Sorrentino