Position Plane along the surface of picked point

I am trying to move a plane to the clicked point but it should rotate parallel to the picked surface (wall/roof/ground).

For example, imagine a hanging painting on the wall. When you click anywhere in the room then it should hang on the clicked position.

This is what I have done so far, it works well for the ground but on the ceiling & the wall, I get the perpendicular rotation.


Please I need help

You need to use the world-space normals:
var axis1 = pickInfo.getNormal(true);
Another way of doing it:
No idea which one is better, I guess that comes down to testing.


Perfect :ok_hand: Thank you @Raggar