- Home /
rotation in a clockwise manner
i need to make my character rotate when it wants to move backward...this is my script below...
var speed : float = 6.0; var speed2 : float=10; var jumpSpeed : float = 8.0; var jumpSpeed2 : float = 18.0; var gravity : float = 20.0; private var moveDirection : Vector3 = Vector3.zero; var pop : AudioClip;
function Update() {
if(Input.GetKeyDown(KeyCode.RightArrow)){
animation.Play("TIMI ANIMATION");
}
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded) {
moveDirection = Vector3(0, 0, Input.GetAxis("Horizontal"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if(Input.GetKey(KeyCode.UpArrow)){
moveDirection.y = jumpSpeed;
audio.PlayOneShot(pop);
}
}
}
function HighJump(){
var controller : CharacterController = GetComponent(CharacterController);
moveDirection.y = jumpSpeed2;
}
Comment