- Home /
Question by
circleline · Jan 31, 2015 at 07:09 PM ·
rotationtransform
How to i get value of Rotation.Z from the transform component?
I'm trying to do this
if(rotation z == 0){...Do this}
what's the correct code to put in the conditions parameter?
Comment
Answer by SnStarr · Jan 31, 2015 at 11:14 PM
If im not mistaken it Be easiest(on processor usage) to cache the transform first in a variable so you won't have to look it up every time you need to use it, for instance:
public Transform myTransform;
myTransform = GameObject.FindGameObjectWithTag("").GetComponent<Transform>;
then you can use the variable to find the rotation.z:
if(myTransform.rotation.z)
{
}
transform.rotation returns a Quaternion, it needs to be transform.rotation.eulerAngles.z
Your answer
Follow this Question
Related Questions
Simple Script Problem 1 Answer
rotateAround pivots at unexpected point 1 Answer
Rotation speed,Rotate script slows down 1 Answer
how can i stop rotating gameobject but slowly 1 Answer
Rotation not working as expected 0 Answers