playMaker

Author Topic: Trouble with Triggers (resolved)  (Read 1990 times)

part12studios

  • Playmaker Newbie
  • *
  • Posts: 41
Trouble with Triggers (resolved)
« on: July 07, 2018, 11:27:07 PM »
Hi everyone, I'm basically new to PM (used it back with Unity 4.x last time) and this time I'm happy to report I'm having some much better luck with things this time thanks in part to Jonathan O'Duffy's tutorials, but I'm hitting a bit of a wall on this one and can't figure it out...

So I'm doing a flappy bird game.  I've left Jon's tutorial and basically making it my own way and it's going well because I wasn't getting the same results he was following him.. so..

I have pipes spawning in flappy bird fashion..  game is working and so i moved to the scoring system.

my thought was that i'd make a prefab that has a trigger box between the pipes. hit the pipe and int add..  i put the trigger event on the "bird" object and when it enters a tagged item (the trigger box) it should fire off..  but it doesn't.. 

This is where I get confused.  If I don't make the object a trigger.. it works!  but of course it hits a solid object and fails to proceed even though it's invisible.  if I disable the collider of course then the object passes through it but no trigger event occurs. 

So I feel like i'm close.. since I can get it to work when it touches the trigger, but fails to register the object entering it when it's active.

I imagine I could come up with some other ways to achieve score, but I really thought this would be the way i'd like it done and i don't think this is a strange way to look at it, but clearly I'm not doing something right and could really use some help!

Sincerely,
Caleb
« Last Edit: July 08, 2018, 07:59:54 PM by part12studios »

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 150
Re: Trouble with Triggers
« Reply #1 on: July 08, 2018, 04:43:37 AM »
I recommend you take screenshots of the trigger and the bird, then post it here.

At first it just sounds like the bird need a rigidbody.
« Last Edit: July 08, 2018, 04:45:21 AM by DanielThomas »

part12studios

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Trouble with Triggers
« Reply #2 on: July 08, 2018, 01:09:14 PM »
Thanks for the suggestion!  I wasn't sure how to best share shots of relevant things, but i went ahead and did the best i could.

Also the bird does have rigidbody.  Collision was discreet.. but i tried continuous with no difference. 

As I understand it.  The game object the player goes through is the "trigger".  For the tag I have both the trigger object and the player in the "score a point" tag.  I've tried a few combinations with that tag and nothing seems to help. 

So I tried to capture the most relevant things. I just don't get why it won't connect.   

I need to figure out how to update a prefab without having to delete and create a new one.. because i'm making sure that the clones in game inherit the changes made to the game objects in the hierarchy. 
« Last Edit: July 08, 2018, 01:11:12 PM by part12studios »

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 150
Re: Trouble with Triggers
« Reply #3 on: July 08, 2018, 04:12:11 PM »
Are the screenshots the latest and the settings you try with? If so, you need to enable the box collider. And you need to check the "is trigger" box as well.

part12studios

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Trouble with Triggers
« Reply #4 on: July 08, 2018, 06:37:35 PM »
yea sorry that was a slightly outdated pic.. I had fixed it as you can see in these updated screenshots..  I did this:

- made a folder called pipes
- put the top and bottom pipe in that folder (with different tags for game over detection (which works)
- put a trigger object that fits between them as you can see in the screensot
- i made sure the object was set to "is trigger"
- made a prefab from that
- ran the game and confirmed that each of the clones generated also are showing "is trigger"
- play the game and the player object goes right through them without firing off the event. 

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 150
Re: Trouble with Triggers
« Reply #5 on: July 08, 2018, 07:02:39 PM »
Ah, you need to use the "trigger event" action, not collision event.

part12studios

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Trouble with Triggers
« Reply #6 on: July 08, 2018, 07:59:01 PM »
omg.. yes that was it.  That makes so much sense.. I just thought "collision and didn't move beyond that..  thanks!    i knew it had to be something simple!   

Sincerely,
Caleb