Hello, I edited the CharacterController.Move script, and now it won’t jump, I don’t know what I need to do to get it to work. Here’s my current Script:
var speed : float = 12.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;
var RotateSpeed : float = 3.0;
var SprintSpeed = 20;
var Sprinting : boolean = false;
private var moveDirection : Vector3 = Vector3.zero;
function Update() {
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded) {
if (Input.GetButton ("Jump")) {
moveDirection.y = jumpSpeed;
}
moveDirection = Vector3(0, 0,Input.GetAxis("Vertical"));
//Rotate
transform.Rotate(0,Input.GetAxis("Horizontal") * RotateSpeed, 0);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if(Input.GetKey("up")){
if(Input.GetKey(KeyCode.LeftShift)){
transform.Translate(Vector3.forward * SprintSpeed * Time.smoothDeltaTime);
Sprinting = true;
}
}
}
// Apply gravity
moveDirection.y -= gravity * Time.smoothDeltaTime;
// Move the controller
controller.Move(moveDirection * Time.smoothDeltaTime);
if(Sprinting){
SprintingFunc();
}
}
function SprintingFunc(){
BreathDeduct();
}
function BreathDeduct(){
//Take away some breath
}
Thanks in advance for any help!