I am a new programmer and I am trying to do this character controller P.S. I am following Youtube video. But I ran into this problem of ‘object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)’. Can someone explain to me what the problem is? I’d rather understand the problem then try to solve it myself
thank you.
Here is my code its rather simple.
using UnityEngine;
using System.Collections;
public class PlayerMovment : MonoBehaviour {
public float movementSpeed;
private Vector3 input;
void Start () {
}
void Update () {
input = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
Rigidbody.AddForce(input * movementSpeed);
}
}