Forum rules - please read before posting.

How do i make "Trigger 2D" work!?

Hi and thank you for a great plugin!

Im having some trouble with Trigger 2D and how to make them work.
There is no problem in creating the Trigger prefab in the game editor menu.
But when my character walks over the trigger N O T H I N G happens.
Am i missing something? I have my character game object (tagged with "player") and i have the sprite with the animator set as a child object (tagged "Untagged").

I have tried using a 2D circle collider set as "trigger" on both my player game obj and on the sprite child obj, but still nothing..

Is there a step-by-step tutorial on how to make 2D-Triggers work or is there anything else i can do?

Please help.

Using Unity 5.0.0f4 and AC 1.45

Thank you in advance.

Comments

  • Just checking, have you set up an action list to take place when the player walks over the trigger?
  • edited May 2015
    Had the same problem. It's explained in the manual there : http://www.adventurecreator.org/files/Manual.pdf in the 3.1 section.

    You have to add a rigidbody 2D component and a 2D collider to your Player/NPC.

    I think there should be a small tutorial for this as it's not obvious at all. The manual says it can be processor intensive to have these components so that it can be better for performance to remove them if you know you won't use triggers.
  • The character creation tutorial tells you which components you need to add, including rigid body:

    http://www.adventurecreator.org/tutorials/making-unity-sprite-based-character-2d
  • Yes but not the video tutorial which I started with. And the tutorial you linked doesn't explain why you would need a rigidbody or not.

    The information exists but it's not super clear.
  • THANK YOU!
    That was it! I added a Rigidbody 2D and it worked right away. Must have missed that somehow.
    Also i agree, the tutorial is a bit fuzzy about that you need a rigidbody to make triggers work.
  • Hi all! and special @ChrisIceBox

    I'm have a problem with the triggers, I can't make run this. I'm read the manual and the posts, and I apply the steps. I create the trigger. In the script, when the character pass on the trigger, talks one phrase. I add a Rigibody 2D element at Player (at the main, and at the child, the result is the same). I add one 2D box collider on the player. But never runs...

    Anyone can help me? Where is my error?

    Many thanks!!

  • In the script, when the character pass on the trigger, talks one phrase

    As in, that's what's supposed to happen?

    At runtime, the button named "Run now" is enabled in the Trigger's Inspector. So that we know the Actions themselves are correct, does clicking that manually cause the reaction you want?

    The Trigger itself must also have a 2D collider on it. You'll have to share images showing your situation, because I can't tell from your description what the issue might be.

    One thing to note, however, is that with the latest AC release, you no longer need a Rigidbody / Collider on the object to detect (i.e. the Player). Set the Trigger's Detection method to Transform Position, and it'll run when the player's origin position is within the bounds of the Trigger's collider.

  • Hi again!

    I have install the AC last version now (1.68.0). The situation is:

    I had proof the "run now" trick at runtime, and the trigger run OK. But, when in the game the character pass over the trigger, noting happens.

    At the first image, you can see the situation, the trigger, the player (without any Rigidbody or Rigidbody2D elements). If the trigger run OK, the bird fly. In the second image, you can see the character was passed the trigger, but nothing happens. In the third, if I click "Run now", the trigger run, and the bird fly.

    image1

    image2

    image3

    Any idea?

    Thanks!

    P.D.: Sorry, I can't place the images with the image icon... don't appear the OK button.

  • If the Player has no 2D Rigidbody or 2D Collider, it won't react to the Trigger - because your Trigger's Detection method is set to Rigidbody Collision. You must either add the above components, or set this field to Transform Position.

  • I'm feel so stupid... :neutral:

    Many thanks. It's the first time I use a trigger haha...

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!