Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: nluckett on October 13, 2014, 08:14:56 PM

Title: Newb: How do I stop an animation?
Post by: nluckett on October 13, 2014, 08:14:56 PM
I have a character with an animation controller on him (an asset from the asset store) and it works well. I want to add a throw action to him.

I got the ball and spawner and all that figured out, but I can't figure out how to animate the guy doing the throwing motion.

I got it to play finally by creating a sprite based animation called p1_throw and hooked it up to a new state in the Unity Animator called Throw. Then calling that from a Animator Play command on the FSM.

It finally plays... but it loops forever. I tried putting a FINISHED on it and it doesn't do the trick. I tried putting an Animator Stop Playback and that doesnt work either.

Any suggestions?
Title: Re: Newb: How do I stop an animation?
Post by: beaumint on October 13, 2014, 08:56:45 PM
I'm a bit new too, but I know that if you find the animation that you use from the model you imported it off of... you can uncheck 'looping' there and it shouldn't loop...

(http://i.imgur.com/sqauaFU.png)
Title: Re: Newb: How do I stop an animation?
Post by: nluckett on October 13, 2014, 09:57:01 PM
Ok, that is a step in the right direction, thanks!

Now it plays once through without looping anymore. Now I need to get it to play each time I do a button press. It seems like it should cuz the firing of bullets works with each click...

And then I need it to kick me back to my base idle animation state, but it's just staying on the Throw Animator state.
Title: Re: Newb: How do I stop an animation?
Post by: nluckett on October 14, 2014, 02:04:32 PM
Just to bump this, still looking for help.

One thought I had to get it out of the Throw Animator state and back to idle is to maybe just call the idle state at the end of the loop. But Im not sure if that is the right way to do it. Any ideas?
Title: Re: Newb: How do I stop an animation?
Post by: beaumint on October 16, 2014, 06:30:20 PM
Did you figure it out?

You should try playing in the 'animator' section.

That way you can have it play your 'throw animation' and then after it's over it will automatically go back to the idle state.

Then in your playmaker setup you can force it to go back into the 'throw animation' part when you shoot again.

Let me know if you need a little bit more info!
Cheers!
-Beaumint
Title: Re: Newb: How do I stop an animation?
Post by: nluckett on October 16, 2014, 08:21:03 PM
I think I figured it out using the Animator Play action. It then calls a State in a new Layer of the Animator/Mechanic thing. That layer has a default state, and then it has a THROW state that gets called from the FSM. When not called that layer just sits in the default (essentially inactive) state.

See any problems with that? Seems to be working. Fingers crossed.
Title: Re: Newb: How do I stop an animation?
Post by: beaumint on October 16, 2014, 09:01:12 PM
I mean as long as it's getting the job done of what you want/expect then by all means go with it.

If for some reason down the line you don't think it's working let me know, I'll try and see if I can help ^^
Title: Re: Newb: How do I stop an animation?
Post by: nluckett on October 17, 2014, 09:43:05 AM
Thanks man, really appreciate it! Good luck on your projects as well.