Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sp : float = 5.0; var grav : float = 18.0; private var direction : Vector3 = Vector3.zero; function Update() { var contr : CharacterController = GetComponent(CharacterController); if (contr.isGrounded) { direction = Vector3 (Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); direction = transform.TransformDirection(direction); direction *= sp; } direction.y -= gravity * Time.deltaTime; contr.Move(direction * Time.deltaTime); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement