Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Dakk on March 03, 2017, 05:22:30 PM
-
Hi, I am new to Playmaker so there may be an easy answer but I have looked for a while and can't seem to find a way to get a list of all colliders inside a trigger (box collider). Multiple objects in the scene may begin life inside the collider so I don't think Get Trigger Info will work, and Trigger Event only stores a single collider.
I am looking to get a list of all of the objects inside a trigger volume then sort them by their z pos, to do some processing.
Thanks in advance!
-
hi,
is the game starting out with all the objects in the collider?
-
It sounds like you need an OverlapBox
-
You need an array. Try arraymaker (ecosystem). Store all the items in the array and then sort. That would be part of the answer.
-
For a little more context of the problem I am trying to solve: picture playing cards all laying face down on a table in different configurations some on top of others, I want to flip just the top cards over so they are face up.
I would have to cast a lot of rays to sort this out, due to small overlap situations. Overlap Sphere would work, but take a lot of small spheres around the edges of the cards.
I initially started out using get Next Overlap Area physics2D- it worked on initialization fine, but I couldn't get it to update after the cards moved- it always returned a false positive of a card that used to be in the overlap area but had moved. Also I was concerned about being locked into just 2d physics for the entire game as I don't think I could add 3d physics to the background scene.
Tcmeric, how would I get the list for the array? "Trigger Event" just stores a single collider, and running it multiple times will not iterate through the colliders. Get Trigger info returns the last event- but that doesnt work as mulitple colliders start inside the trigger on initialization.
-
I went back and looked at why Next Overlap Area 2D wasn't working- looks like there could be a bug.
It works the first time you pass through the function, but doesn't reset the variables- so running it again after finding a collider will always result in false positives and a return of the previous collider(s). It is possible I am not using it right and there is a way to reset the variables in the function. Does anyone have any experience with this?
Thanks!