Object rotation snaps back to 0°

151224-jan-13-2020-15-16-45.gif

As you can see whenever i press “e” to rotate the object 90° on the y axis it keeps snapping back to 0° regardless of if i even turn it -90°. it only would turn of i put the object at the very corners of the ground then it rotates but when i drag the object away from the edges it will snap back to 0°. How do i solve this.

This is the Code for the rotation of the currently held object, simple.

if (Input.GetKeyDown ("e"))
{
    currentPlaceableObject.transform.Rotate(transform.rotation.x, transform.rotation.eulerAngles.y + 90, transform.rotation.z);
}
else if (Input.GetKeyDown ("q"))
{
    currentPlaceableObject.transform.Rotate(transform.rotation.x, transform.rotation.eulerAngles.y - 90, transform.rotation.z);
}

It doesn’t need to use 2 keys it could just be so that whenever i press "r"it will successfully rotate a full 90°.

Hello,

When you use Rotate Unity will take the current position and add the vector3 passed as parameter. Try remove “transform.rotation.” with 0f, then just on the axis that you want rotate insert the degrees that you want.

Something like that →

if (Input.GetKeyDown ("e"))
 {
     currentPlaceableObject.transform.Rotate(0f, 90f, 0f);
 }
 else if (Input.GetKeyDown ("q"))
 {
     currentPlaceableObject.transform.Rotate(0f, -90f, 0f);
 }

I hope I helped you. Greetings