Playmaker Forum

Playmaker Help & Tips => Playmaker Tips & Tricks => Topic started by: redikann on February 23, 2015, 10:25:06 AM

Title: Using The Animator Editor to broadcast variables
Post by: redikann on February 23, 2015, 10:25:06 AM
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.
Title: Re: Using The Animator Editor to broadcast variables
Post by: jeanfabre on February 24, 2015, 12:40:43 AM
Hi,

 Interesting!

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

 Bye,

 Jean
Title: Re: Using The Animator Editor to broadcast variables
Post by: redikann on February 24, 2015, 07: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.
Title: Re: Using The Animator Editor to broadcast variables
Post by: wetcircuit on February 24, 2015, 07: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!
Title: Re: Using The Animator Editor to broadcast variables
Post by: PlaymakerNOOB on April 05, 2015, 01: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
Title: Re: Using The Animator Editor to broadcast variables
Post by: coffeeANDsoda on June 20, 2015, 09:23:04 PM
Would be neat if someone made a tutorial for that.