It would be something like
if (Input.GetKeyDown(KeyCode.D))
{
//and here the rotation
}
It would be something like
if (Input.GetKeyDown(KeyCode.D))
{
//and here the rotation
}
What have you tried so far?
something like
CharacterTransform.transform.Rotate(0, 0, 0);
it only adds the rotation it needs to set it to something
Rotate() is like “add the rotation”, not “replace it”.
In your case you need:
var euler = transform.eulerAngles;
euler.x = 0;
transform.eulerAngles = euler;
Thank u it worked!