Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Update(){
- //assumes class has a float "XSensitivity", CharacterController "controller", and Quaternion "characterTargetRotation"
- Vector3 fwd = this.gameObject.transform.forward * Input.GetAxis("Vertical") * speed;
- Vector3 rgt = this.gameObject.transform.right* Input.GetAxis("Horizontal") * speed;
- Vector3 move = (fwd + rgt);
- characterTargetRotation *= Quaternion.Euler(0f, Input.GetAxis("Mouse X") * XSensitivity, 0f);
- this.gameObject.transform.localRotation = characterTargetRotation;
- controller.SimpleMove(move);
- }
Advertisement
Add Comment
Please, Sign In to add comment