Rotate object inverse ground
I want to make a horse for my game and simple prototype will have horse based on Rigidbody...
I have problem: I want to horse be always pointing up from terrain something like spider pointing down when on ceiling and up if on floor and right if on wall... i figured out that i can get normals from raycast but i don't know how to convert them to rotation... please help :)
Answer by hexagonius · Feb 10, 2016 at 07:16 PM
Here you go:
http://docs.unity3d.com/ScriptReference/Quaternion.LookRotation.html
pass transform.Forward of the horse as first and the normal you received from the raycast as second parameter and set the horse rotation to the result.
Your answer
Follow this Question
Related Questions
I rotated the camera and the cubes look weird 1 Answer
Animation and CharacterController in Unity3D 1 Answer
Rigidbody AddForce() stops working after walking away for a while 0 Answers
Torque rigidbody toward desired rotation on two axes ignoring Y axes? 0 Answers
Adding relative torque on x and y causes z changes 0 Answers