playMaker

Author Topic: Animation Play Controls  (Read 5201 times)

mTruly

  • Junior Playmaker
  • **
  • Posts: 98
Animation Play Controls
« on: January 08, 2016, 10:58:39 AM »
Unity 5.3.1/playMaker 1.8

Imagine a simple animation... cube moves across screen.

Ultimately, I want to create a full set of animation playback controls:

play button - plays the animation
pause button - pauses the animation on current frame
stop button - stops the animation and rewinds to beginning
go to beginning -
go to end -
slider - scrolls through the animation
etc.

(If this setup already exists somewhere please let me know)

I have successfully created an FSM on the animated cube which will play the animation from a button.

I have successfully created an FSM on the Main Camera which scrubs the animation via a slider.  This contains the Set Animation Time action.

But once the Set Animation Time is enabled... the slider works for scrubbing the animation but the PLAY button no longer works.  It seems the Set Animation Time is somehow prohibiting the PLAY button Play Animation action from working.

Any idea what I'm doing wrong here?

Thanks for any ideas!
« Last Edit: January 08, 2016, 05:19:38 PM by mTruly »

mTruly

  • Junior Playmaker
  • **
  • Posts: 98
Re: Animation Play Controls
« Reply #1 on: January 08, 2016, 05:20:40 PM »
And I can't get the Rewind Animation action to rewind the animation.

mTruly

  • Junior Playmaker
  • **
  • Posts: 98
Re: Animation Play Controls
« Reply #2 on: January 20, 2016, 04:19:40 PM »
OK, I finally managed to get a setup with buttons that will play the animation, pause the animation, rewind the animation (rewind action does not work), stop the animation.

I also am able to have a slider that scrubs through the animation.

But I can not get the controls and the slider to work at the same time and have the slider be syncronized with playback when using the 'Play' button.

When the 'Set Animation Time' action in the slider FSM is active... the 'Play' button will not play.  If I disable the 'Set Animation Time' action in the slider FSM, then the 'Play' button will play the animation.

Any ideas?

Thanks!

mTruly

  • Junior Playmaker
  • **
  • Posts: 98
Re: Animation Play Controls
« Reply #3 on: January 25, 2016, 07:37:01 PM »
Any ideas on how to setup the states to make this work.

I have a button that plays a legacy animation... I have a slider that will scrub the legacy animation... but I'm not sure how to make both the button and the slider function at the same time as currently the slider will override the button function.  If I disable the slider... then the button will play the animation just fine.

So they are conflicting and I'm not sure how to setup states so these controls coexist.

Thanks!

MH

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Animation Play Controls
« Reply #4 on: March 17, 2016, 02:53:09 AM »
Hi, I'm really interested in how you got your slider to scrub through the legacy animation. I'm having a problem where as soon as I mark an animation as legacy, it no longer works and the PlayMaker FSM can no longer find it.

mTruly

  • Junior Playmaker
  • **
  • Posts: 98
Re: Animation Play Controls
« Reply #5 on: March 17, 2016, 09:51:42 AM »
Not sure what the legacy problem might be.  When I have a legacy animation, the Play Animation action is able to play it.

For the slider (I use Unity sliders), I use the U Gui Slider Get Value and Set Animation Time actions.  The Slider Get Value fills a variable and the Set Time uses that variable to set the animation time so it matches the slider position.  Then the slider and animation are in sync.

Hope this helps!

MH

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Animation Play Controls
« Reply #6 on: March 17, 2016, 08:15:40 PM »
Thanks a lot. That sounds pretty much exactly like what I did, except I used the PlayMaker slider. I'll try again with the Unity one. Thank you!

MH

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Animation Play Controls
« Reply #7 on: March 21, 2016, 03:43:35 AM »
So, I have no idea what I'm doing wrong and it's starting to drive me a bit ment'l. As above, I want to control the playback position of an animation with a slider.

A very basic set-up:

An object with an Animation component that has an animation assigned to it.

On the same object I have an FSM (see pic) which gets the sliders value (U Gui Slider Get Value) which I assigned to the variable "SliderValue".

I then used "Set Animation Time" to the animation in question and used SliderValue in the time field.

Ticked "Every Frame"

When I play the game, nothing happens. I must be doing something fundamentally wrong and I can't for the life of me figure it out.

Any suggestions?

Thanks a lot in advance :)


mTruly

  • Junior Playmaker
  • **
  • Posts: 98
Re: Animation Play Controls
« Reply #8 on: March 21, 2016, 10:42:36 AM »
Tick the 'Normalized' checkbox on the Set Animation Time.

Hope this helps!

MH

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Animation Play Controls
« Reply #9 on: March 21, 2016, 08:56:43 PM »
Unfortunately that didn't work either. But I've since realised that it is only 2D sprite animation that won't play under these circumstances.

I found this out because I created a simple cube and animated it moving across the screen in unity. This worked when I set it to legacy and I was able to control it with the slider.

But for some reason 2D sprites do not play through the different sprites within their animation when in legacy mode. No idea.

Thanks for the suggestions :)