Hey guys and gals!
For a networking project I need a framerate independent movement script (for obvious reasons). I saw this one on UnityCookie but it only moves on the global axis not the local axis. What do I need to change to make it move locally instead of globally?
var speed : int = 5;
var gravity = 5;
private var cc:CharacterController;
function Start (){
cc = GetComponent(CharacterController);
}
function Update (){
if(networkView.isMine){
cc.Move(Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, - gravity * Time.deltaTime, Input.GetAxis("Vertical") * speed * Time.deltaTime));
}
else {
enabled = false;
}
}
Thanks in advance!
↧