playMaker

Author Topic: Multi Collision/Multi-trigger event  (Read 2421 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Multi Collision/Multi-trigger event
« on: January 17, 2015, 01:28:41 PM »
In 'collision event' action and 'trigger event' action, it only looks for a single collision/trigger tag.  It'd be really cool to be able to set up more than one.  This would avoid making a bunch of FSM states checking for every single collision tag. 

So let's say you have a 4 player game and there is an area that only 2 of the 4 players can go, then you can use the player1 and player2 tags to let pass but not player3 or player4 tags.

Would be very useful to a lot of people.
« Last Edit: January 17, 2015, 04:54:04 PM by wheretheidivides »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14595
  • Official Playmaker Support
    • View Profile
Re: Multi Collision/Multi-trigger event
« Reply #1 on: January 19, 2015, 12:46:55 AM »
Hi,

 Simply have 4 of these actions on the same state. Have you tried that?

 Bye,

 Jean

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Re: Multi Collision/Multi-trigger event
« Reply #2 on: January 21, 2015, 01:02:50 AM »
So if I have 4 different on collision events on 1 state, how does that work?  Does the state look at the first one, then 2nd, then 3rd, then 4th?  When it finds a match, then goes to the 'send event'?

So this gets me to another question.  on a state like this, does playmaker go though all of the actions all of the time (unless told to exit)?

Also, do you see my confusion.  Scripting 'oncollisionenter' just waits but what you are saying I can have 4 of these in 1 state and all 4 get run unless 1 is met and tells it to goto next state.
« Last Edit: January 21, 2015, 01:06:36 AM by wheretheidivides »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Multi Collision/Multi-trigger event
« Reply #3 on: January 21, 2015, 05:11:29 AM »
Using multiple Collision Event action's in a single state is standard. I agree it would be nice it the layer dropdown allowed multiple selection.

Action stacks are executed from top to bottom and you generally don't want to mix update types in the same state if you need to rely on this flow. OnEnter is called for all actions in the state, then OnUpdate is called, etc..

To be specific, 4 Collision Events would be evaluated top to bottom and as soon as one of them fires then of course the transition is made to the appropriate state and any actions below it would not be given the opportunity to run their OnUpdate cycle for that frame. The likelyhood of two different collisions of different layers occurring on the same object in the same frame and resulting in an uncaptured collision because of this stacking practice is not significant enough to avoid the practice altogether.

A more valid concern would be the fact that we're running 1 action for each layer and there is a potential performance impact. But, in reality this is likely insignificant as well but really depends on the game and the volume of these states you would have running at any given time.
« Last Edit: January 21, 2015, 05:15:54 AM by Lane »

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
    • View Profile
Re: Multi Collision/Multi-trigger event
« Reply #4 on: January 21, 2015, 09:20:35 AM »
I had these set up as separate FSMs but switched over.  Now I have several collision events tested in 1 state and then multiple events to exit it depending on the collision event.  Thanks for the tip.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4585
    • View Profile
    • jinxtergames
Re: Multi Collision/Multi-trigger event
« Reply #5 on: January 25, 2015, 06:52:41 PM »
maybe an interesting idea is to be able to add multiple tags to a collision action?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4585
    • View Profile
    • jinxtergames
Re: Multi Collision/Multi-trigger event
« Reply #6 on: October 08, 2019, 02:51:50 PM »
Hi.
I made a action for multiple tags, but its is not yet performance tested.

If someone can test them so i can add them to the ecosystem :)

i made one for 2D and 3D.

Natecurt

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Re: Multi Collision/Multi-trigger event
« Reply #7 on: October 11, 2019, 11:03:05 AM »
If someone can test them so i can add them to the ecosystem :)

The 3D version seems to be working perfectly in my project. It's much more compact this way, thank you!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14595
  • Official Playmaker Support
    • View Profile
Re: Multi Collision/Multi-trigger event
« Reply #8 on: October 13, 2019, 11:32:21 PM »
Hi Kurt,

 Can you put them on the Ecosystem? thanks!

Bye,

 Jean