playMaker

Author Topic: Collision Event with multiple objects  (Read 104 times)

PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
Collision Event with multiple objects
« on: September 06, 2021, 04:58:43 PM »
Collision Event only has space for a single object, what if I need to store more than one collision event?
I mean, surely it doesn't happen so often that an object collides with 2 at the same time in the same frame, but it does happen, and what if in my case this happens quite often?
I need to know if my object is in contact with other 2 objects, how to do this?

ch1ky3n

  • Full Member
  • ***
  • Posts: 195
    • View Profile
Re: Collision Event with multiple objects
« Reply #1 on: September 07, 2021, 06:53:28 AM »
I don't think it is possible the collision happens at the "same time" and cancel the others. It still has the queue of which is first but it happens at the same frame of course. Thus, giving you the last entry.

to get all entries, add each information to an array. then, every object enters will be indexed under the array

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6398
    • View Profile
    • jinxtergames
Re: Collision Event with multiple objects
« Reply #2 on: September 07, 2021, 07:33:01 AM »
Hi.
You could do something like a boxcast

i also have a action from array maker that lists game objects inside collider.
But not sure if it works for colliders or only triggers.

I have added the script in the attachment but you need to have array maker installed, else you get errors.

I have also added the array maker package but only use if you don't have it installed yet.

Also make a backup if you install ArrayMaker Package just ot be sure that you can revert (if you get errors you can also share here and i can see if you need some ohter package as well, like Utils for example)
Ecosystem might not work at the moment
here are direct Github Links to the custom actions :
https://github.com/PlayMakerEcosystem
https://github.com/jeanfabre


Join the PlayMaker Discord Channel!

PolyMad

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
Re: Collision Event with multiple objects
« Reply #3 on: September 08, 2021, 04:45:41 AM »
Thank you!!!