I'm trying to control a 3D object (just a box for the moment) moving over a spherical 3D planet, I'm using a Ray to find the triangle in the sphere under the object. I'm calculating the surface normal and it's working this far but now I want the object to be rotated or just forced to be align according to the surface normal of the triangle from the sphere so that the object's down vector will be in the same angle as the surface normal vector so that it has the right angle against the surface.
I've searched the Internet but haven't succeeded yet after a couple of weeks. How on earth can I make my object align to the surface normal while moving freely around the planet/sphere?
I'm trying to make like a car driving around on the surface of a sphere.
The question is, how can I align the object to the surface normal? The code I have this far is to find the triangle under the box, now I would like to align the object to it.
I'm using Monogame in C# VS Studio 2017