playMaker

Author Topic: [SOLVED] Having issues getting on enter trigger event to work  (Read 4893 times)

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
I'm having trouble getting on enter trigger event to work.

What should my checklist be to make sure both the trigger and the object entering are primed for firing off this event?

I'm not sure if it matters to mention I'm using 2D Toolkit and making a 2D game?
« Last Edit: May 28, 2012, 12:50:49 PM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

bluequoll

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Having issues getting on enter trigger event to work
« Reply #1 on: May 28, 2012, 01:26:42 AM »
Hi there,

make sure the object that gets entered has trigger on and the object that enters has trigger off. Also make sure you actually have box colliders on both objects. Let me know

V.

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Re: Having issues getting on enter trigger event to work
« Reply #2 on: May 28, 2012, 01:36:15 AM »
Thanks for the response.

I'm trying to get 2 un-rendered boxes to recognize that they've collided (entered).

One of the boxes has trigger checked, and the other does not.

Anything else I should be checking for?

I've got the Z value of the boxes set to large amounts (100), and turning the screen sideways visually depicts what would seem that they would enter if they collided on the orthographic camera.
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Re: Having issues getting on enter trigger event to work
« Reply #3 on: May 28, 2012, 02:09:45 AM »
I've taken the following screenshots to show what's going on in my screen:

One is of a box that I want to have as the trigger (which is the child of a unit)

Another is the box that is the child of a unit that i want to interact with the trigger

the third picture is the action in the FSM attached to the box WITH trigger selected

the fourth is a picture from the side that shows the boxes.

This is bottlenecking my combat prototype since I can't register "On Hit" type events without these triggers working, so any help would be greatly appreciated.

Note: Both parents of the boxes are on Z axis 50
« Last Edit: May 28, 2012, 02:17:04 AM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Jernau

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Having issues getting on enter trigger event to work
« Reply #4 on: May 28, 2012, 03:22:37 AM »
Triggers in Unity require at least one of the Colliders to have a Rigidbody component attached. You can turn off "Use Gravity" and turn on "Is Kinematic" on the Rigidbody component if you don't want your GameObject to be affected by the physics engine.

The Box Collider page in the Unity manual is well worth reading, especially the matrix at the bottom which details the various combinations of collision actions that Unity handles.

bluequoll

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Having issues getting on enter trigger event to work
« Reply #5 on: May 28, 2012, 04:08:31 AM »
Also be careful when using colliders that are children of other objects. If the parent has a box collider too for example that could cause problems at least in my experience.

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Re: Having issues getting on enter trigger event to work
« Reply #6 on: May 28, 2012, 10:24:22 AM »
Thank you very much! =D  I knew it was something simple I was forgetting.

Also thank you for that resource!

After reading that resource I can see what blue is saying about the children causing issues.  Is there a way to make the children not report back to the parent and just interact on their own?  Without childing these colliders I'm not sure how else I would have separation of hit boxes, environment colliders, and different skill/attack area of effect boxes.
« Last Edit: May 28, 2012, 10:28:34 AM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com