How do I controll a Character using the Mecanim Animator with Player Joysticks?

So i made a character and followed the tutorial at

That like is a tutorial on how to integrate the Mecanim Animator with your characters with your keyboard.

So my question is how do you integrate is this with the Player Relative Joysticks?

The keyboard handles axes the same as anything else.

Look at AngryBots tutorial project at the FreeMovementMotor and PlayerMoveController scripts.

They contain things like:

		if (joystickPrefab) {
			// Create left joystick
			var joystickLeftGO : GameObject = Instantiate (joystickPrefab) as GameObject; = "Joystick Left";
			joystickLeft = joystickLeftGO.GetComponent.<Joystick> ();
			// Create right joystick
			joystickRightGO = Instantiate (joystickPrefab) as GameObject; = "Joystick Right";
			joystickRight = joystickRightGO.GetComponent.<Joystick> ();			

Which helps you put many control methods in, platform dependant.

And look at this!

function Update () {
		motor.movementDirection = joystickLeft.position.x * screenMovementRight + joystickLeft.position.y * screenMovementForward;
		motor.movementDirection = Input.GetAxis ("Horizontal") * screenMovementRight + Input.GetAxis ("Vertical") * screenMovementForward;

Input.GetAxis (“Horizontal”) and
Input.GetAxis (“Vertical”)

Brilliant eh?

It does pay to check out the Input manager, but to be honest I don’t use it.

I won’t be specific, but the way you do it without using the code in that tutorial is to set buttons as the Player Joystick buttons so that later you can say in your script:

if (Input.GetButtonDown(“yourJoystick”)){

//connect to the state machine and do desired action