Answer the question
In order to leave comments, you need to log in
How to get rotation angle value by y coordinate in gameobject?
Hello, I need to get the value of the gameobject's rotation angle, but I still can't do it, tell me in which direction to dig?
This is what I need to get:
This is what I get in the end:
The one circled in blue is what I get like this:
mainObject.GetComponent<Transform>().rotation.normalized.y
mainObject.transform.rotation.ToAngleAxis(out y, out v) // в Y переменной типа float
Answer the question
In order to leave comments, you need to log in
I don't know why you need a transformation..
mainObject.transform.rotation.ToAngleAxis(out y, out v);
would you describe what effect you want to achieve ... what and how to rotate))
repeat the angle along Y.
did you try it ??
but I think it will be the same ..
you see, the point is in what ..
Quaternion.Lerp - it will always turn in the NEAREST side))
quaternions are generally arranged like this))
it will not work for you to do "two turns clockwise" or something similar .. like this way ..
for rotation, this is equivalent to the fact that nothing has changed ..
you can try to remember and accumulate exactly NUMBER .. ANGLE))
and then lerpit, for example, from zero to 720 ...
just substituting Y directly.
then there will be two turns clockwise ..as in animation..
good luck.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question