I have a control system set up for a rigid body character, but the movement isn’t relative. How do I make it relative?
#pragma strict
var MovementSpeed : float;
//var JumpHeight : float;
private var MovementVer : int;
private var MovementHor : int;
function Update() {
MovementVer = Input.GetAxis("Vertical") * MovementSpeed * Time.deltaTime;
MovementHor = Input.GetAxis("Horizontal") * MovementSpeed * Time.deltaTime;
}
function FixedUpdate () {
rigidbody.AddForce(Vector3(MovementHor, 0, MovementVer));
}