playMaker

Author Topic: Using The Animator Editor to broadcast variables  (Read 9062 times)

redikann

  • Full Member
  • ***
  • Posts: 174
Using The Animator Editor to broadcast variables
« on: February 23, 2015, 12:25:06 PM »
Something I started doing that worked based on a hunch, start sending Playmaker variables that I wanted to track per frame with no interruption  to the Animator. So I created a controller called 'Variables' and attach it to my Gameobject leaving the Avatar null.
Now for example I could use a 'Get axis vector' and send the input to the animator with x,y,z floats and a magnitude float. From any other FSM I could retrieve those variables. You could do this with the 'StateMachine variable' actions but that entails not forgetting where things are when logic starts to pile up.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using The Animator Editor to broadcast variables
« Reply #1 on: February 24, 2015, 02:40:43 AM »
Hi,

 Interesting!

 Could you share an example? or do you intend to distribute it via the asset store?

 Bye,

 Jean

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Using The Animator Editor to broadcast variables
« Reply #2 on: February 24, 2015, 09:51:20 AM »
It is all done with what Unity has built in. I attach an animator component to my object and then create a Controller for it that I call 'Variables'. I don't bother giving it an Avatar. With that setup and the Playmaker Animator Actions I can start sending it information in variables . Now I have an easy way to look and watch in real time during play and other gameobjects can see this information.
I could have an FSM that only updates my Health to the Animator controller and any other Game object could look at that variable.

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
Re: Using The Animator Editor to broadcast variables
« Reply #3 on: February 24, 2015, 09:54:46 AM »
It is all done with what Unity has built in. I attach an animator component to my object and then create a Controller for it that I call 'Variables'. I don't bother giving it an Avatar. With that setup and the Playmaker Animator Actions I can start sending it information in variables . Now I have an easy way to look and watch in real time during play and other gameobjects can see this information....
;D TUTORIAL! TUTORIAL!

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 219
Re: Using The Animator Editor to broadcast variables
« Reply #4 on: April 05, 2015, 04:37:52 PM »
I don't currently have a need to track variables on a per frame basis.  However it did intrigue me enough to try it out.

The simplified version is:

-Install Mechanim addon actions
-Create EmptyGameObject
-Add an Animator Component
-Add an Animation Controller to the Animator component
-Create the Parameter variables you wish to track on per frame basis in the Animator under Parameters
-Create a Playmaker FSM on the Empty GameObject (any variables sent to and from this will be updated on a per frame basis)
-Use Set Animator Bool, Float, Int, Trigger actions locally
Then on your object where your interested in reading those variables
-Create Empty GameObject called DestinationGameObject
-Create FSM
-Use Get Animator Bool, Float, Int, Trigger action.  Change GameObject from "Use Owner" to "Specify Game Object", and select the Empty GameObject
-Ensure that parameter names both match "EmptyGameObject" and "DestinationGameObject"
-Store the results like normal

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Using The Animator Editor to broadcast variables
« Reply #5 on: June 21, 2015, 12:23:04 AM »
Would be neat if someone made a tutorial for that.