- Home /
How do I Rotate Towards a Plane?
I have a character who starts off in zero g and then enters a place with > 0 g. In zero g the character has 6 degrees of freedom to fly around, in gravity he behaves like an any character in an fps. How do I rotate him so that he stands upright in gravity? Some more details, I need to pitch and roll the character so that he goes from any orientation in space, to feet pointed down towards the ground.
It's about aligning two vectors.
Give your character a local "up" vector, that represents the orientation of the character standing upright. Then define an "up" vector for the world. Usually Vector3.up should do.
Then use: Quaternion.FromToRotation to get a quaterion you can use to rotate your character to align both up vectors.
This sounds like it's exactly what I need, Ill try it out tomorrow :D
Your answer
![](https://koobas.hobune.stream/wayback/20220612092625im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
VR: Controller rotation delta along other axis 2 Answers
How can I turn my cube object to the direction it is traveling? 1 Answer
Rotating a Vector direction by another Vector direction in one axis 1 Answer
Rotate object instead of camera around it? 0 Answers
0-360 Y degree from Vector3.Angle 1 Answer