playMaker

Author Topic: Multiple collisions and priority  (Read 2478 times)

cats00eye

  • Playmaker Newbie
  • *
  • Posts: 47
Multiple collisions and priority
« on: October 01, 2015, 09:28:51 AM »
Basic question is simple: when a game object has a Trigger 2d Event action testing for trigger-enter, and there are multiple objects inside the collider, which one does it return?

I did a test which confused me more than I was already. Game object G is in the centre of the scene. There are three other objects C1,C2 and C3 all within G's collider and successively further from G - C1 being the closest and C3 being the furthest. G has only one FSM consisting of a state which runs Trigger 2d Event (on trigger enter), stores the collider and, on success, transitions to an empty state. Debug flow is on for the FSM. The collider stored is C3.

Moving, C1 so that it is the furthest from G (C2 now being the closest), the collider returned is still C3.

There didn't seem to be any geometric logic to that, so thought it might simply have something to do with the order in which the objects were created (C3 was the last). So I deleted C2 and created another C2, still the closest to G, and sure enough, G's collider now returned C2.

So, to revise my basic question: when an object is testing for collisions and there are several at once, does it simply return the collision object that was most recently created? (Also, is the logic of how this works a Unity or a Playmaker thing?)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Multiple collisions and priority
« Reply #1 on: October 01, 2015, 01:36:01 PM »
Hi,
i have been playing around with it but when i duplicated several object (10+)
it took something somewhere in the middle and not the latest created.

I also noticed when you played once, the next time it seems to be "locked" to that object, even when you delete other object.

and i think it is a unity thing

Anyone else who knows?

cats00eye

  • Playmaker Newbie
  • *
  • Posts: 47
Re: Multiple collisions and priority
« Reply #2 on: October 02, 2015, 07:06:32 AM »
Thanks. Yes, I thought it was probably Unity. Suggests we need to handle colliders with extreme caution.