I have my character setup in mecanim.
I need to understand how I can integrate PlayMaker i.e.. "get Touch " to trigger the mecanim transition from idle to walk & a jump.
Edit - OK I have the character walking in mecanim. but just a single state.. so he simply walks, I have no control. I do have a separate Blend tree setup in mecanim with idle/run / jump. just need to understand how Playmaker can trigger finger gestures to trigger each mecanim transition.
this script might help...
but currently I'm having issues with the lines in Bold since they all refer to keyboard Input (not ios Touch)
I get the following error :
error CS1502: The best overloaded method match for `UnityEngine.Input.GetTouch(int)' has some invalid arguments
using UnityEngine;
using System;
using System.Collections;
[RequireComponent(typeof(Animator))]
public class BearCtrl : MonoBehaviour {
protected Animator animator;
public float DirectionDampTime = 0.25f;
void Start ()
{
animator.GetComponent<animator>();
}
void Update ()
{
animator.SetBool ("Jump",Input.GetTouch ("Touched") );
float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical"); animator.SetFloat("Speed", h*h+v*v);
animator.SetFloat("Direction", h, DirectionDampTime, Time.deltaTime);
}
}
NOTES: Variables created in mecanim
- Jump = a Boolean Param I created in mecanim.
- Direction = float
- Speed = float
Touched = an event I created in PlayMaker.