So today I found this script: Unity - Scripting API: CharacterController.Move that I copied down and I’m pretty sure I copied it correctly but I can’t get it to work.
#pragma strict
var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;
private var moveDirection : Vector3 = Vector3.zero;
function update(){
var controller : CharacterController = GetComponent(CharacterController
);
if (controller.isGrounded){
moveDirection = Vector3(Input.GetAxis(“Horizontal”), 0,
Input.GetAxis(“Vertical”));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *=speed;
if (Input.GetButton (“Jump”)){
moveDirection.y = jumpSpeed;
}
}
moveDirection.y -=gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}
function Start () {
}
function Update () {
}
I created a character controller and I attached it to the “player” then I attached the script onto that. When I try to play it however it doesn’t do to let me move around, however when I look at the script I don’t think there are any errors.