Hi all, quick very basic question. My code is to rotate the gameobjects local x rotation by 5deg every getkeydown. This works once but then will not work again. I don’t understand as the localRotation should be 0,0,0 each time the Update() is run, as this object is the parent object. In my mind this should increase the rotation of the objects x axis by 5 deg each getkeydown event. Can someone please show me where I am going wrong, or even a simpler way to do this, thanks.
void Update()
{
if (Input.GetKeyDown("joystick button 4") && ObjectToRotate != null)
{
RotationAmount = 5;
ObjectToRotate.transform.localRotation = Quaternion.Euler(RotationAmount, 0, 0);
}
}