playMaker

Author Topic: Trigger not firing problem  (Read 1462 times)

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
    • View Profile
Trigger not firing problem
« on: February 22, 2016, 03:25:48 AM »
Hello everyone,

I am working on a game where there is a Death Zone setup at the bottom of the screen (similar to that in most platformer games). I have an FSM on the Death Zone with a starting state that contains "Trigger Enter 2D" event (the game is in 2D). This event tests for a tag called Enemy and stores the object it collided with.

Once that fires, it sends an event to the another state that destroys the collided object.

The object I am testing has a movement setup where it moves towards (using the Move Towards action -- I tried finish distance 0, 1, -1 and same thing) an object just above the Death Zone and continue moving till it touches the Death Zone. However, it doesn't get destroyed at all.

I tried to change the setup from "Trigger Event 2D" to "Trigger Info 2D" but it is the same exact problem.

I thought maybe if the FSM isn't on the Death Trigger and on the enemy itself it would work. It didn't unfortunately.

Any idea how to resolve the issue please? It has been bugging me for hours (I have Death Trigger's Box Collider marked as trigger).

Thank you very much in advance.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Trigger not firing problem
« Reply #1 on: February 22, 2016, 04:26:22 AM »
Trying adding a rigid body and set Is Kinematic to true on the objects-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Vallar

  • Junior Playmaker
  • **
  • Posts: 90
    • View Profile
Re: Trigger not firing problem
« Reply #2 on: February 22, 2016, 07:14:24 AM »
That worked like a charm... I didn't know Unity doesn't take into account anything without a Rigidbody when dealing with triggers... thanks a lot!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Trigger not firing problem
« Reply #3 on: February 22, 2016, 10:36:57 AM »
No problem  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Zeldag

  • Full Member
  • ***
  • Posts: 198
    • View Profile
Re: Trigger not firing problem
« Reply #4 on: February 22, 2016, 11:10:13 AM »
Yeah this has been confusing me for ages.

 Im at the stage now where any colider that needs to send event or provide some other info, i srick a rigid body on it. Even if it just an empty game object. Any collider that is just for colliding i dont (eg: walls, floor).

But i think this confusion is not helped by playmaker's warning notice when you add a trigger event action, which says something along the lines of: 'the object needs a rigid body OR collider to use this action' when in fact the object needs both (in my experience).

But thank you for clearing this up, that it is not just colliders messing me around but thats how it works. Thanks.