playMaker

Author Topic: 2d Animation - How to call it[SOLVED]  (Read 774 times)

Gignormaz

  • Playmaker Newbie
  • *
  • Posts: 8
2d Animation - How to call it[SOLVED]
« on: May 16, 2020, 07:35:41 AM »
Hi!

I've got an image and I'm looking to play a "smoke poof" animation on top when hit.

I've got the everything set up and working, it's just creating/activating the animation from my "HIT' FSM.

Do I need the animation as a seperate object on top that comes in to view and plays or can I create the animation on top from the FSM. I'm also a bit confused about the animator or animation component and which to use/call upon.

If anyone could clear this up it'd be greatly appreciated!! Thanks!
« Last Edit: May 18, 2020, 10:15:38 AM by Gignormaz »

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: 2d Animation - How to call it
« Reply #1 on: May 16, 2020, 08:21:12 AM »
Depends.

If it’s an animation, it can be an animation state in mechanim. And played just as you play jump etc.

If it’s a separate object, you have at least two options. First, make the hit effect its own prefab. Since it’s a hit effect, I assume it will be used fairly often. For things like that it’s usually best to just parent it with the player.

Activate technique: Set to inactive on top of the inspector, and when hit, switch it on with the game object activate (enable?) action. You can either use wait and activate (but set to false) to make it disappear again, or add an FSM on the hit effect itself that waits for brief moment and then deactivates itself.

Play technique: the default state is an empty animation clip or better a particle that is not active (play on awake false). When hit, use the ecosystem action Particle Play All, and it then fires the effect once. If it’s an animation, trigger the animation state with the smoke graphics (I would recommend particles, but if you use animator, try animator cross fade action). Then set the animation or particle to only play once.

How it’s shown depends entirely on the render settings, sorting layer, order in layer, z-position, and suchlike. If it’s a particle, you may adjust it in the particicle system.

Gignormaz

  • Playmaker Newbie
  • *
  • Posts: 8
Re: 2d Animation - How to call it
« Reply #2 on: May 18, 2020, 10:14:23 AM »
That's a great response, thank you.

I might try just setting it up with an activate and wait system as I'm not really looking to do a lot with it, just a puff of smoke in a static position.

Got a much better idea of how to handle something else I had as well, so cheers!  :D