playMaker

Author Topic: Trigger Event Tag [SOLVED]  (Read 2036 times)

shadieb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Trigger Event Tag [SOLVED]
« on: July 26, 2017, 08:41:26 AM »
I have a player spaceship tagged as player and its weapon is a particle effect blaster tagged as blaster. Both have colliders attached and are set to rigidbody.

I have a stationary rocket that I want to launch as soon as the player makes contact with its trigger. The trigger is a sphere collider with trigger set and it is approx. 5 times the size of the rocket.

I have a PM trigger event attached to the sphere with the collide tag set to player.

Everything works perfectly except  the rocket still launches if the ships blasters hit the trigger collider despite the collide tag being set to player only.

I can't find much in the way of tutorials for trigger events other than the basic open doors type of tutorials which I have watched and I believe the way I have things set it should work?

Am I using the trigger event correctly?
I am using Unity 2017.1.0f3 and latest PM.

Any help is greatly appreciated. Thank you.
« Last Edit: July 26, 2017, 11:55:58 AM by shadieb »

Deek

  • Full Member
  • ***
  • Posts: 126
    • View Profile
Re: Trigger Event Tag
« Reply #1 on: July 26, 2017, 09:05:15 AM »
Could be that your blaster is child of the spaceship and the trigger events treats all colliders of a GameObject and it's children as one.
If that's the case, maybe try separating the blaster from the ship and see if the trigger event still fires if it hits the standalone blaster GameObject.
If no, we know who's the culprit and can find a workaround, if still yes, the problem must be elsewhere (maybe some incompatibility with the latest Unity version (2017)).

shadieb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Trigger Event Tag
« Reply #2 on: July 26, 2017, 09:43:07 AM »
Thanks for the reply.

Unfortunately the blaster isn't a child of the player, it is a prefab that is brought into the scene when fire is pressed.

I have owned PM for quite a while but have only just started using it. I have noticed there appears to some small issues around Unity 2017 and PM such as the Eco system not working properly.  Maybe causing me this problem?

I have thought about making a larger FSM that gets the collision info then uses it to make sure it is the player making the collision and then proceed from there?

It would be good to get some clarity on this though and some confirmation that I am using the trigger event correctly with the tags?

Thank you again for your input :)

shadieb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Trigger Event Tag
« Reply #3 on: July 26, 2017, 10:55:55 AM »
I don't know why this works but it has solved my trigger issue.

The blaster was an empty gameobject named and tagged blaster, with a particle system as a child object. There is an FSM attached to the empty gameobject named blaster that fires the weapon from its spawn point.
The only thing I noticed was that the particle effect child object was untagged. I tagged this as blaster and now everything works as it should. The collider on the rocket now only detects the ship tagged as player :)

I am most likely wrong, but it seems to me that the trigger event action looks for a tag but also treats anything untagged as that tag, if that makes sense?

Thanks Deek for putting me in the right direction :)

Deek

  • Full Member
  • ***
  • Posts: 126
    • View Profile
Re: Trigger Event Tag
« Reply #4 on: July 26, 2017, 11:32:23 AM »
Well I'm glad I could help, even though indirectly.

It's true that the Trigger Event treats "Untagged" as a tag, but that doesn't mean that it should have fired the event when you specify another tag.
Looking into the action it checks it like: "If the other GameObject has the exact same tag as the one specified by the user, fire event."
That should normally exclude "Untagged" ...weird.

If you consider your problem to be solved, you might wanna add "[SOLVED]" to the title for others to see if your inquiry is still relevant.


Have a great time and keep on creating,

Deek

shadieb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Trigger Event Tag
« Reply #5 on: July 26, 2017, 11:55:23 AM »
It definitely works, but I do agree the untagged tag should be treat as just that.
Can only assume a possible issue with Unity 2017.1 but at least it is a workaround I can work with.

I will take your advice and mark the thread as solved.

Thanks again for the help.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14237
  • Official Playmaker Support
    • View Profile
Re: Trigger Event Tag [SOLVED]
« Reply #6 on: July 26, 2017, 12:02:49 PM »
Hi,

 To properly handle any tag, simply set the property to "none" so that it point to no variable and then it will literally accept any tag instead of expected "untagged".

It's twisted, I give you that :)

 Bye,

 Jean

shadieb

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Trigger Event Tag [SOLVED]
« Reply #7 on: July 26, 2017, 02:31:55 PM »
jeanfabre  are you saying we should set the collide tag to none in the trigger event action?
If so how would that work when we want to get a result from a certain object setting the trigger, such as the player?

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14237
  • Official Playmaker Support
    • View Profile
Re: Trigger Event Tag [SOLVED]
« Reply #8 on: July 31, 2017, 12:18:44 AM »
Hi,

 if you want to do so, then the tag is "player" isn't it? Maybe I don't understand your questions. If you have a use case, let me know, I'll see how to proceed with it.

 Bye,

 Jean