First time poster and Unity user. Picked it up for a class project and having fun so far. I’ve recently run into an issue I’m at my wit’s end trying to resolve. I’ve been using rigid bodies to attempt to move my character across the map I’ve made. While he will play his walk animation, he only moves in place, and is not displaced at all. I’ve also tried the Character Controller and more “standard” forms of movement, but that didn’t seem to work either. The character just stays in one place and plays his walk animation without actually walking around. Any thoughts?
Related code from my script attached here:
public class PC : MonoBehaviour {
public GameObject pChar;
//Character Vars
public float walkSpd; //walking speed
// Use this for initialization
void Start () {
pChar = GameObject.FindGameObjectWithTag("Player");
walkSpd = 2.00f;
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.UpArrow)) {
animation.Play("Walk");
rigidbody.AddForce(Vector3.forward * walkSpd);
}
}
}
I usually like to solve problems myself, but I’m kind of puzzled here. Would greatly appreciate any advice. Thanks!