Im trying to make a 2.5D game so i want the player to run along the x axis, I can get him to run right but not left, I know i can use a transform function to flip him around but I cant even get him to “moon walk”
heres my code
using UnityEngine;
using System.Collections;
public class controller_and_anim : MonoBehaviour {
public Animator anim;
public Rigidbody rbody;
private float inputH;
private float inputV;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
rbody = GetComponent<Rigidbody> ();
}
// Update is called once per frame
void Update () {
inputH = Input.GetAxis ("Horizontal");
inputV = Input.GetAxis ("Vertical");
anim.SetFloat ("inputH", inputH);
anim.SetFloat ("inputV", inputV);
float moveX = inputH * 100f * Time.deltaTime;
if (0 < moveX && moveX < 1.1f) {
rbody.velocity = new Vector2 (moveX, GetComponent<Rigidbody> ().velocity.y);
}
if (0 < moveX && moveX < -1.1f) {
rbody.velocity = new Vector2 (-moveX, GetComponent<Rigidbody> ().velocity.y);
}
}
}
`heres what I tried to do in the animator