playMaker

Author Topic: What is the proper way to trigger simple animations w/ the Mechanim Actions?  (Read 3558 times)

qwertyqwertyqwerty

  • Playmaker Newbie
  • *
  • Posts: 3
Simple Scenario: I have an NPC character that needs to switch quickly and smoothly, from running to shooting.   The NPC is a humanoid rig powered by Mechanim animations.  I'm currently using the free Mechanim actions package from this website.

Back in my old system (before PlayMaker), I used animation crossfades and later, Mechanim triggers to do the animations.  Now with PlayMaker, it seems like the only solution is to set Animation Bools for every animation, then in the FSM, create actions to set the Animation bool to true, and all other animation bools to false.  That's what I'm doing at the moment.

Problem is, this seems difficult to manage.  For example, in my "Shoot" FSM, I have the actions set up something like:
1) Set Animation Bool "Shoot" = true.
2) Set Animation Bool "Run" = false.
3) Set Animation Bool "Idle" = false.
4) Set Animation Bool "Jump" = false.
5) Set Animation Bool "Crouch" = false.

You get my drift.  I want the character to stop running, and perform a shooting animation.  If I don't set all other animations to False, then both the Shoot and Run animations will play concurrently.

This seems like a messy way to go about setting up mechanim animations.

Is there a better, simpler way?   Again, I simply want to have an NPC perform "Run" with a simple action, then perform "Shoot" and automatically stop the "Run" action.  This was doable through my old scripts that used Triggers and crossfades, but not possible with PlayMaker unless I'm missing something here...

any help would be nice! thanks in advance.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
You can use Mecanim triggers with Playmaker just fine- just add the animator actions https://hutonggames.fogbugz.com/default.asp?W1031 and use the "Set Animator Trigger" action

Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

qwertyqwertyqwerty

  • Playmaker Newbie
  • *
  • Posts: 3
You can use Mecanim triggers with Playmaker just fine- just add the animator actions https://hutonggames.fogbugz.com/default.asp?W1031 and use the "Set Animator Trigger" action


wow, thanks mdotstrange! I thought I had the most recent version of the mechanim actions (just a few wks ago)...apparently not.  I just downloaded the current version and SetAnimatorTrigger is in there!  Wasn't in my previous version.