Quantcast
Channel: Questions in topic: "keyboard"
Viewing all articles
Browse latest Browse all 605

How can I change Z rotation of a FPS player ?

$
0
0
Well I am challenged by making my player tilt his body, so I should change the Z rotation(when I press Q or E), but have some issues whit it because my camera moves really questionable while I am pressing Q or E and moving the mouse. Here is some part of the code: if (Input.GetKey(KeyCode.Q)) { playerController.transform.rotation *= Quaternion.Euler(0, 0, 20 * Time.deltaTime * 10); Quaternion t = playerController.transform.rotation * Quaternion.Euler(0, 0, 20 * Time.deltaTime * 10); if (t.eulerAngles.z > 20) { t = Quaternion.Euler(t.eulerAngles.x, t.eulerAngles.y, 20); } playerController.transform.rotation = t; }

Viewing all articles
Browse latest Browse all 605

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>