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;
}
↧