Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Dreamwriter on August 04, 2014, 03:32:45 PM

Title: [SOLVED]Trigger 2D Event ignoring Collide Tag
Post by: Dreamwriter on August 04, 2014, 03:32:45 PM
Hi,

We're trying to make a door open when the hero walks into it, and that works just fine.  Unfortunately, it also opens when shot by a blaster.  We set the Collide Tag in the Trigger 2D Event to "Player", which is the tag our hero has; the blaster's tag is "Invulnerable".  But the blaster still opens the door.

Any ideas?
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: Sly on August 04, 2014, 03:36:37 PM
Can you attach a screenshot of your playmaker action?
It will show us better if everything's right.
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: Dreamwriter on August 04, 2014, 03:50:59 PM
Here it is
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: jeanfabre on August 05, 2014, 07:08:32 AM
Hi,

 You MUST attach a "PlayMakerUnity2DProxy" component for this to work. Please read the wiki page where you downloaded the Unity 2d Package, it's explained properly.

https://hutonggames.fogbugz.com/default.asp?W1150

If that's still doesn't work, let me know.


 Bye,

 Jean
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: Dreamwriter on August 05, 2014, 09:46:26 AM
Add the proxy to the FSM script object?  We tried adding that to the door with the FSM script on it, and it didn't help.  The door functions when the player touches it, it just also functions when a laser touches it, though the laser's tag isn't "Player".
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: PlaymakerNOOB on August 05, 2014, 09:30:40 PM
While I am not dreamwriter I did have the same issue.  Not sure how I overlooked the proxy, but thanks that did it!
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: snortch on August 05, 2014, 11:29:22 PM
If I'm running playmaker 1.7.7.f6, do I need to install what Jean mentioned (https://hutonggames.fogbugz.com/default.asp?W1150) in order for 2d collisions to work?
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: jeanfabre on August 06, 2014, 12:57:17 AM
Hi,

 in all playmaker versions you must have this proxy on your 2d gameobject if you want the 2d global events to work ( the proxy forwards them events, so no proxy, no 2d collisions or 2d triggers).

 Bye,

 Jean
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: Dreamwriter on August 06, 2014, 09:58:07 AM
I've attached two new screenshots, the FSM (now with 2D proxy) activated and one showing the details of the green_shot that's activating it.  Any ideas?
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: jeanfabre on August 06, 2014, 11:05:33 AM
Hi,

 http://issuetracker.unity3d.com/issues/rigidbody2d-with-kinematic-rigidbody-will-not-cause-ontriggerenter2d

 You can't have kinematic bodies to trigger in 2d,

 Bye,

 Jean
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: Dreamwriter on August 06, 2014, 12:34:26 PM
But we can, it is working.  The problem is not that we aren't getting collisions, it's that we are getting collisions and then the Playmaker code checking against the collider's tag isn't working, so the thing gets activated when it shouldn't.
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: jeanfabre on August 06, 2014, 01:00:10 PM
Hi,

 I see, sorry about the confusion, you are using the global event on an action that is supposed to have its own unrelated event.

 under the hood "TRIGGER ENTER 2D" is fired by the proxy for ALL triggers, and the trigger2d action allows you to filter, but if you use this "TRIGGER ENTER 2D" then the action itself is completly shunted.

 so, do this test, create a brand new local event "MY TRIGGER" and use that in the action, it will work.  "TRIGGER ENTER 2D" and similar global events are only supposed to get used as global transitions not as event to use within actions.

Bye,

 Jean
Title: Re: Trigger 2D Event ignoring Collide Tag
Post by: Dreamwriter on August 06, 2014, 02:00:21 PM
That fixed it, thanks!
Title: Re: [SOLVED]Trigger 2D Event ignoring Collide Tag
Post by: snortch on August 07, 2014, 09:51:20 AM
Jean - I think the answer you gave Dreamwriter might be the solution to my problems as well (http://hutonggames.com/playmakerforum/index.php?topic=8055.0), but I'm not quite following your fix suggestion.

When you said, "create a brand new local event "MY TRIGGER" and use that in the action, it will work." Does that mean that you're asking Dreamwriter to create an event and then add the "Trigger 2d Event" action to the State? Or are you saying that Unity automatically detects the trigger event and so the "Trigger 2d Event" action isn't needed?

Can you clarify?
Title: Re: [SOLVED]Trigger 2D Event ignoring Collide Tag
Post by: jeanfabre on August 08, 2014, 07:34:42 AM
Hi,

 ok:

 the global event "TRIGGER 2D EVENT" is a global event that my system fires everytime it detects that a 2d collider entered. This is exactly the same as the global system event build in PlayMaker "TRIGGER EVENT".

So, you should NEVER use global events that are fired from frameworks within an action ( within any actions), because then it's not just your action that can fire this event, it's anything since it's a global event, it can be fired from anywhere by anyone!

so, rule of thumbs, ALWAYS create a local event to use in your actions, and so in your  "Trigger 2d event" action, only use local events, and you will never get mixed up. "trigger 2d event" does filter by tag, and does a lot more work then just firing an event everytime something triggered that collider.

 Does that make more sense?

 a typical error as well would be to use a global mouse event such as "MOUSE DOWN" in your action. you may be tempted to do so in a mouse input action, but you understand that then how do you know if it's the action or the system that fired this event? do a test with a cube and an fsm with a bool test action ( that runs everyframe) with the "Is True" firing a "MOUSE DOWN" global system event, leave the bool to false and click your mouse on the cube, the event from the bool test will be fired... oups.... the same confusion goes one on the trigger 2d event and action.

 Bye,

 Jean