How can i rotate an object using a normal vector obtained from a surface normal?

So…
I am using a single line trace to get information from the first actor I encounter in my line of view as the player.
To give a little background, I am trying to complete a system of functions where a player can spawn in an object from his/her inventory and place it in a valid space in the world.

So far…
it spawns successfully, the line trace helps relocate the object to the location the character is aiming (updates every game tick), and the material changes to green if its a valid location and red if its an invalid location. It only lets you place it if its not in collision with anything else. Wonderful.
But… I would like it to rotate depending on the impact normal obtained from the surface of the actor the trace picks up.
So if the ground isn’t flat(angled), then the object should be rotating accordingly…
Or if the character is aiming at another form of surface that isnt flat, it should rotate according to the surface normal.

How can I achieve this?
So far I have… it gives me the normal vector but I was not successful in accomplishing my goal.
Thank you in advance!

I just ran into this working on some raytrace functionality myself. Turned out to be fairly simple. Once you break the raytrace result, take the “impact normal” or “normal” output and convert it into a rot with a “rotation from xvector” node. Plug that into whatever you need to rotate (that takes a rot value) and you should be set! Worked for me placing some decal stuff.

1 Like