playMaker

Author Topic: Animation To Play Depending On 'Sanity'  (Read 1273 times)

JordanIbanez

  • Playmaker Newbie
  • *
  • Posts: 1
Animation To Play Depending On 'Sanity'
« on: March 13, 2016, 11:32:01 AM »
Hi!

I've run into some confusion as to how to achieve the following, but first some context.

I am testing some mechanics for a game, and a mechanic that is imperative to the game is animations playing depending on a "sanity" float (perhaps rather an integer, to equate to animation frames.) To elaborate, the level of sanity dictates the part of the animation that plays. i.e, main character's sanity is draining slowly, so the planks of wood in the walls start to distort, and as the character's sanity rises, the walls start to return to normal.

Let's say the animation of my walls are 100 frames, at 25 fps, and the sanity meter goes from 0 to 100. I'd like to link these ideas in that the sanity meter is slowly rising in equal ratio to the frames of the animation, as well as the reverse happening when sanity is depleting.

Any ideas?
Thanks!
Jordan

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: Animation To Play Depending On 'Sanity'
« Reply #1 on: March 13, 2016, 12:49:30 PM »
Hi and welcome to the forum!!

Im just a noob here, but i may have an idea that works for you.

Sounds like a very interesting game already, by the way.

I was thinking, wouldnt it be easier to use seperate animations (sperate each frame (or group of frames for each level of sanity) into a single animation), then you could use a blend tree that is dependant on a sanity int parameter- which would be set by your sanity playmaker int.

So in fsm you would have a 'set animator int' action setting the sanity int into the animator int parameter that you will use for the blend tree.

Then the blend tree and animator would do the rest.

I think you can split the frames in the import settings in the inspector, not sure as i havnt imported raw animations myself, but seen it in tutorials...

Also you will need the extra mecanim actions to do this: https://hutonggames.fogbugz.com/?W1031

I hope this works for what youre trying to achieve. Good luck with it!

(also i wont blabber on about how to use the blend trees and animator too much. Firstly because you sound like you know better than me, secondly because i dont know that well myself. But if you dont know what to do, just say and ill try to explain what seems to work for me.)
« Last Edit: March 13, 2016, 12:53:19 PM by Zeldag »