my character walking animation is working but character not changing the place.
i watch this tutorial to make my project i do as shown in tutorial but at this stage i stuck ( Unity 5 Tutorial - Animation Control - YouTubealt text )
here are my codes : i don’t know what to do
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move : MonoBehaviour
{
public Animator anim;
public Rigidbody rbody;
private float inputH;
private float inputV;
// Start is called before the first frame update
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*20f*Time.deltaTime;
float moveZ = inputV*50f*Time.deltaTime;
if(moveZ <= 0f){
moveX = 0f;
}
rbody.velocity = new Vector3(moveX,0f,moveZ);
}
}
hot-18.png