playMaker

Author Topic: Using playmaker to script input for mechanim animation[SOLVED]  (Read 1874 times)

PlayU

  • Playmaker Newbie
  • *
  • Posts: 5
Using playmaker to script input for mechanim animation[SOLVED]
« on: November 12, 2014, 11:43:33 PM »
Hey,
  I have my animator set up with the Speed and Movement floats.  I just want to have to press the "w" key for my character to walk and "r" key to run.  Do I use the get key function for the animator..don't know where to start.
« Last Edit: March 02, 2015, 09:40:34 AM by jeanfabre »

cmonroy

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Using playmaker to script input for mechanim animation
« Reply #1 on: November 20, 2014, 03:02:55 PM »
Simple: set the speed variable to 1 when W is pressed and to 0 when is not. Do the same with R, but set the speed to 2 when pressed and to 0 (or 1) when not...

From the action browser, use the GETKEY to check if the desired key is pressed or not. Use the TESTBOOL to test its value. If TRUE, send the flow to another state to assign the corresponding value to animator variable with ANIMATORSETFLOAT and return to the listener state; do the same when FALSE but reset the values to 0 in another state and then return to the listener state (the one which "listens" for the key pressed.

PlayU

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Using playmaker to script input for mechanim animation
« Reply #2 on: March 02, 2015, 08:06:15 AM »
Thank you cmonroy! :)