- Home /
How to rotate vector along its local y axis?
Want to set local y rotation of vector. So if my vector is (0, 0, 0). I would just set it as (0, desiredRotation, 0). But if my vector is (40, 15, 30). How would i rotate it so that the "local axis" of the vector remain the same other than "local y axis".
A vector doesn't have a specific local y axis. If you consider the vector as z, then anything at 90 degrees to it could be either x or y (then the last local axis can be only 1 thing).
But the "obvious" local y axis would be yy=Quaternion.LookRotation(myVector)*up. Then use that with AngleAxis.
Answer by blue_coder · Jan 05, 2020 at 03:14 AM
Well, i think you just want to use the y of your desiredRotation, so use desiredRotation.y
, making this Vector3(0, desiredRotation.y, 0)
.
Your answer
![](https://koobas.hobune.stream/wayback/20220612221043im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Transfer axis global rotation on local axis of another object 0 Answers
I thought I was doing this right, but it gives me an error. 0 Answers
Point game object to another only on the Local X Axis 0 Answers
rotated position, together with the object (around the origin) 0 Answers
how do i make rigidbody. velocity follow the objects local rotation? 1 Answer