Please help me make GameObject FlipY when RotationZ is less than -90. I know something is wrong with my script I just need to help to fix it.
if (gameObject.transform.rotation.z < -90)
{
weaponRenderer.flipY = true;
Debug.Log("FLIP");
}
if (gameObject.transform.rotation.z > -90)
{
weaponRenderer.flipY = false;
}
the console message is not being shown too.
Comment
is it in update? if yes then might be your object is in exact -90 zRotation. if not the paste it in update. and also you can siplify thi like below
int flipY = transform.localEularAngles.z < -90 ? -1 : 1;
@goutham12 thank you! the code is in Update. What do you mean by my object being in exact -90 zRotation? Sorry im kinda new to coding.
Answer by goutham12 · Oct 13, 2019 at 05:15 PM
Change your if conditions like If (gameobject.transform.rotation
Your answer
![](https://koobas.hobune.stream/wayback/20220612213153im_/https://answers.unity.com/themes/thub/images/avi.jpg)