- Home /
LookRotation(same forward, different Upwards);
I am trying to have a ball's up axis match the rotation of the normal of the ground it sits on. I've used a number of different systems, but the most clean why seems to be to use `down.rotation = Quaternion.LookRotation( ___ , hit.normal);` the problem is the forward, I want my object to point the same forward as before. so i tried using down.forward, but that just gives me some weird stuff. I can use:
var temp = down.rotation.y;
down.rotation = Quaternion.LookRotation(Vector3.forward, hit.normal);
down.rotation.y = temp;
but I'd rather something a little cleaner. Anyone know how to fix it?
Answer by whydoidoit · Sep 24, 2012 at 09:40 PM
How about rotating the up of down (oh you should really choose a better name :)
down.rotation = Quaternion.FromToRotation(down.up, hit.normal) * down.rotation;
Your answer
![](https://koobas.hobune.stream/wayback/20220613081437im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Keeping transform.forward facing forwards 1 Answer
My LookRotation forces my character to snap back, and face starting direction after I stop moving? 2 Answers
Need help with rotation 4 Answers
Spawning objects to the surface of a spehere correctly. 0 Answers
Setting an objects angle about a local axis without localEulerAngles? 0 Answers