- Home /
Question by
ThanksTnx · Jun 12, 2017 at 09:09 AM ·
unity 5rotationif-statements
Using a rotation in an if statement
Hello guys so I'm trying to get a specific rotation angle and make it do something... But it doesn't work.
public Transform a, b
void Update()
{
if (a.localRotation.eulerAngles.z == 0 && b.localRotation.eulerAngles.z == 30)
{
Debug.Log("Works GREAT!");
}
}
My issue though is that it works when I do this...
void Update()
{
if (a.localRotation.eulerAngles.z >= 0 && b.localRotation.eulerAngles.z >= 30)
{
Debug.Log("Works GREAT!");
}
}
or this...
void Update()
{
if (a.localRotation.eulerAngles.z <= 0 && b.localRotation.eulerAngles.z <= 30)
{
Debug.Log("Works GREAT!");
}
}
I need to get exact values though and then do something.
Please Help.
Comment
Your answer
Follow this Question
Related Questions
How do i determin if an objects rotation is between 2 values on each axis? 0 Answers
How to lock rotation in z of my camera while rotating the camera by using mobile gyroscope input 0 Answers
Quaternions acting up 1 Answer
I'm trying to create a game that you move forward and back and rotate left and right. 0 Answers