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

So i made a character and followed the tutorial at https://www.youtube.com/watch?v=Xx21y9eJq1U

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 UNITY_IPHONE || UNITY_ANDROID
		if (joystickPrefab) {
			// Create left joystick
			var joystickLeftGO : GameObject = Instantiate (joystickPrefab) as GameObject;
			joystickLeftGO.name = "Joystick Left";
			joystickLeft = joystickLeftGO.GetComponent.<Joystick> ();
			
			// Create right joystick
			joystickRightGO = Instantiate (joystickPrefab) as GameObject;
			joystickRightGO.name = "Joystick Right";
			joystickRight = joystickRightGO.GetComponent.<Joystick> ();			
		}

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

And look at this!

function Update () {
	// HANDLE CHARACTER MOVEMENT DIRECTION
	#if UNITY_IPHONE || UNITY_ANDROID
		motor.movementDirection = joystickLeft.position.x * screenMovementRight + joystickLeft.position.y * screenMovementForward;
	#else
		motor.movementDirection = Input.GetAxis ("Horizontal") * screenMovementRight + Input.GetAxis ("Vertical") * screenMovementForward;
	#endif

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

}