Animation Playmaker

Hi there,

I am quite new to Unity so please bear with me. I have a character, a human with three animations: run, air squats and pistol squats). I want to make it run from point A to B in a loop and every time it reaches point A or B it should play either squat animation. Can this be done with Playmaker? If so how? Is there any tutorial on that, I tried on google and did not find anything like this.

Thank you very much!

It can definitely be done in playmaker.

You will need additional (but free) actions probably, such as navmesh agent actions: Unity Pathfinding

And the mecanim animator controller actions:
https://hutonggames.fogbugz.com/?W1031

Then it is a matter of setting up an fsm on the character that triggers the animations.

(eg: set up 2 empty game objects for point a and point b, both with colliders that are marked as triggers, rigid bodies and tagged (eg: “Waypoint”).

Setup the character with an animator controller (with the animations all setup so that each transition to a squat; has a trigger as a condition and each transition to a run anim; is on exit time), rigid body, navmesh agent and collider.

Bake a navmesh on your floor (google a tutorial as it is super simple but i always thought it looked complex before having it explained)

Setup the character fsm:
state1: use ‘set animator trigger’ action to set the running animation. Use the ‘agent move’ or ‘set agent destination’ to move the caharacter towards point a. Use an on ‘trigger event’ (triggered on entry to point a, via tag (eg: “waypoint”)) action to switch to state 2.

In state 2; set animator trigger again so that it plays the squat animation. Use ’ wait’ action to stay in the state for the time it takes to squat, then send to state3.

In state 3 copy state 1 but set the nav agent destination to point B. Trigger event by tag again and go to state 4.

In state 4; copy state 2 but use the other squat animation))

Ps: if you want to randomise the squat animation add this state (1.5 and 3.5) below between the run (state1&3) and squat states (2&4):

So states 1.5 and 3.5: use ‘random int’ action and generate an int variable between 1-2 (so either). Use a compare int action and if equal to 1 go to state 2(squat a) from state1/state3(running states)- if int is higher than 1 go to state 4(squat b).

Haha, hope my ramble is understandable to you as it is a basic idea of how to do it…

Good luck with it, ask me if you need clarification or an expansion on it, as i was trying to summarize lol…

PPS: there are plenty of awesome tutorials on youtube, just have a good search. Also try to come over to the playmaker forums for really playmaker speciffic questions, i find people are more knowledgable on playmaker issues there, while here you can get really good help with unity specific and scripting related issues (at least that is my tactic).