playMaker

Author Topic: Find all collision objects  (Read 2763 times)

mweyna

  • Full Member
  • ***
  • Posts: 242
Find all collision objects
« on: November 07, 2013, 04:06:32 PM »
Right now I'm trying to find all objects within a collider with a specific Tag. I have an FSM that basically searches for a collision change (Stay, Enter, Exit) and then that the appropriate step to add that object to an array list. However, I've noticed that the process breaks down if an object leaves the collision area when the FSM is on a different frame, so that the "Exit/Enter" isn't recorded properly, because the FSM is in the process of doing the effect action for the object that just did something. Is there a command or way to basically "Find all objects colliding"?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Find all collision objects
« Reply #1 on: November 08, 2013, 01:09:19 AM »
Hi,

To do this you need to maintain a list yourself and yes, you need to have this fsm only doing this job of registering else it will fail as you found out.

--  the fsm ONLY responds to TRIGGER ENTER and TRIGGER EXIT and only add the hit gameobject to the arrayList or remove that hit gamobject. It should do it in the very state that you have these global transition on.

If you want to trigger more complex features, then you would likely need to implement it on the object that colliders not on the one that you want to maintain all collision, so that it prevents shunting the process.

 Does that make sense?


WARNING: don't use STAY, while it works in some case and scripts, I would not recommand using this in PlayMaker, prefer maintaining a boolean flag that you raise to true when you get a TRIGGER ENTER and lower to false when you get a TRIGGER EXIT.

Bye,

 Jean


mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Find all collision objects
« Reply #2 on: November 08, 2013, 01:41:15 AM »
Makes sense. I'll keep experimenting around with systems. In general I try to avoid adding FSMs as much as possible given the sheer volume and complexity I already have. Thanks for the heads up in the STAY action too.