I’m a 3D modeler and animator by trade but I’m seriously struggling with coding for basic avatar movement.
I already have a character modeled and he’s imported along with animations for idle, walking forward (with offset), side stepping (with offset) and turning.
So far, I’ve managed to make an animation controller and this simple script that makes my guy walk forward from left to right and side-step to the foreground and background.
using UnityEngine;
using System.Collections;
public class HeroControlC : MonoBehaviour
{
Animator anim;
CharacterController control;
void Start ()
{
anim = GetComponent();
}
void Update ()
{
float movex = Input.GetAxis (“Horizontal”);
float movez = Input.GetAxis (“Vertical”);
anim.SetFloat(“Direction”, movex);
anim.SetFloat(“Side Step”, movez);
}
}
However, I’m pulling my hair out trying to make him pivot to the left. My idea is to reference a trigger parameter that cues the turning animation with opposite horizontal axis input and he keeps walking in that direction while the input is held. MY most successful attempt resulted in a LOOOONG delay between the button press and the pivot.