playMaker

Author Topic: Help moving an object up and down with a trigger  (Read 6245 times)

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Help moving an object up and down with a trigger
« on: July 08, 2014, 10:28:07 PM »
Hello everyone! I'm having a problem with something very simple. I have an object that I want to lower when I enter a trigger and raise when I leave the trigger. I looked online and even followed this tutorial https://www.youtube.com/watch?v=9vAAnt2uboU (which is very good) but I'm running into issues.

Here is what I have:
I have an object with four animations.  Up, move down, down, and move up.
I have a playmaker dealio that looks just like the tutorial. I have it set up to play the move down animation when I enter the trigger and play the move up animation when leave the trigger.

Here are my problems:
When I test the scene (press play) the object doesn't start in the up position.  The move up animation plays.
When I enter the trigger the move down animation plays (as expected) but as soon as it ends the object shoots back up and the move down animation plays again in a loop.

When I leave the trigger everything works as expected.

If anyone could suggest a way to make this work I would appreciate it!

thehive

  • Playmaker Newbie
  • *
  • Posts: 24
Re: Help moving an object up and down with a trigger
« Reply #1 on: July 08, 2014, 11:18:36 PM »
seem you have the event sending back to close when the move down animation is done

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #2 on: July 08, 2014, 11:29:50 PM »
How would I go about making that work correctly?

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #3 on: July 09, 2014, 05:25:46 PM »
Anyone else feel like taking a crack at it?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Help moving an object up and down with a trigger
« Reply #4 on: July 09, 2014, 08:58:48 PM »
You're using global transitions to detect trigger in and out.  Use trigger actions on the same states so you can stop an animation when your character moves away, or starts an animation when they move into the trigger zone.

Think about it logically - why would you have your animation trigger on the Start of your level? You'd only want to it start when something happens. (I.e. so don't have your Animation action on your Start global transition.)

You need more states, and think about logically when/how you want those triggered.

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #5 on: July 09, 2014, 11:22:50 PM »
Ah, thank you.  The only reason I have it the way it is was because the tutorial did it that way and I thought it would work for my scene.  Thanks for the advice. :]

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #6 on: July 11, 2014, 11:25:39 AM »
I have to say I feel foolish but I'm not too proud to ask for help. I still can't get this simple thing to work. I've watched and read tutorials but I think I'm missing some basic info to get this working. If anyone has the time I would really appreciate if you could give me a diagram of how you think this would work. If anything just for the learning experience so I don't have to ask simple questions like this in the future. :]

If you enter the trigger, play the down animation and stay down. If you leave the trigger, play the up animation and stay. I appreciate any help you can provide!

Michaelb

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 53
Re: Help moving an object up and down with a trigger
« Reply #7 on: July 11, 2014, 11:40:03 AM »
Your problem is part --> and stay down , correct?

If yes , then after play animation , add --> stop animation , point the object you want and stop the animation it played previously.

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #8 on: July 11, 2014, 11:52:52 AM »
Unfortunately just reading that doesn't make too much sense to me. I think I would need to have a visual representation in order to understand. I purchased this because I'm more of a visual person haha.

Michaelb

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 53
Re: Help moving an object up and down with a trigger
« Reply #9 on: July 11, 2014, 12:05:23 PM »
I am on a working project right now , and deadline is close.

I will make you one , once i finish ok? Deal ? LOL   ;)

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #10 on: July 11, 2014, 12:07:40 PM »
Haha I really appreciate it.

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #11 on: July 12, 2014, 06:16:53 PM »
The frustrating thing is I just followed the tutorial step by step and made my own door that opens horizontally with the SAME state machine and it worked.  I'm starting to wonder if it's an issue with animating something that moves vertically vs horizontally.

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Help moving an object up and down with a trigger
« Reply #12 on: July 13, 2014, 02:48:23 AM »
Shot in the dark here. First problem is that you have a state firing from 'Start'. It's not actually waiting for a trigger. As soon as the game hits On Start it starts (as it is supposed to work in Playmaker in the first state)
Second problem (I'm guessing here) in state two you probably are firing an event (trigger exit) from an action. A  system collision event does not need to be called from an action in a state. It will happen because a collision entered or exited.
« Last Edit: July 13, 2014, 02:51:23 AM by redikann »

Tack

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Help moving an object up and down with a trigger
« Reply #13 on: July 14, 2014, 01:38:51 PM »
I did find a workaround although it was pretty unorthodox.  I mentioned that I followed the door tutorial step by step and it worked, so I thought I'll just do a sanity check and see if the object I'm trying to move would work correctly if there is a second object moving with it like the door (the door being two objects that move away from each-other). 

Turns out it works.  I stacked the objects on top of each other and had them move apart.  One part moves the direction I want it to and I just made the second object non-renderable in Unity.  So it works but it's kind of a weird setup.

Either way, I hope this helps anyone who is having the same problem and can't figure out a solution. 

mikejkelley

  • Full Member
  • ***
  • Posts: 136
Re: Help moving an object up and down with a trigger
« Reply #14 on: July 15, 2014, 07:49:20 AM »
If your state machine is exactly the same as in the tutorial, then the issue is most likely w/ your animations. There are a million different things that can go wrong in the inspector window of an animation.

Quote
When I test the scene (press play) the object doesn't start in the up position.  The move up animation plays.

Having "Play Automatically" checked might do that.

Quote
I have an object with four animations.  Up, move down, down, and move up.

Your state machine has two states so you should probably have two animations. Move up and move down w/ up and down being the last frames of each of their respective animations.
« Last Edit: July 15, 2014, 07:53:29 AM by mikejkelley »