- Home /
Question by
vertex · Oct 16, 2010 at 08:57 PM ·
angleeuleranglesvaluesingle
How to turn a single eulerAngle measurement of a moving game object into a variable?
print (transform.eulerAngles);
This of course prints three numbers to the console. I need the second number-- the "y"-- to use as a variable in a calculation of a new value. How do I obtain/get the y value (which is ever-changing as it's from a moving object) and assign it a variable name?
Comment
Answer by Rasmus Schlnsen · Oct 16, 2010 at 09:43 PM
Not quite sure if this is actually what you want, but anyway
print (transform.eulerAngles.y);
float y = transform.eulerAngles.y;
Your answer
![](https://koobas.hobune.stream/wayback/20220613075908im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I call a function containing a while loop, inside the update function? 2 Answers
How do I clamp the Z-Axis Rotation for this code? 1 Answer
follow an object's x-axis and have it translate smoothly into another object's z-axis rotation 1 Answer