Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var jumpSpeed : float = 12.0;
- var gravity : float = 20.0;
- private var moveDirection : Vector3 = Vector3.zero;
- function Update() {
- var controller : CharacterController = GetComponent(CharacterController);
- moveDirection = Vector3(0, jumpSpeed, 0);
- if (Input.GetButton ("Fire2")) {
- moveDirection.y += jumpSpeed;
- }
- moveDirection.y -= gravity * Time.deltaTime;
- controller.Move(moveDirection * Time.deltaTime);
- }
Add Comment
Please, Sign In to add comment