var speed = 25;
var rotateSpeed = 1;
var curSpeed = 25;
function Update ()
{
var controller : CharacterController=GetComponent(CharacterController);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
}
@script RequireComponent(CharacterController)
Attach this script to your player Object,hope this works :D
↧