A good way to place objects at normals?

Hey internet brain!

Is there a nice way to place objects on an object snapped to the the normal position as shown below?

I want the player to be able to place objects with the mouse so that they snap to the normal position on the object. In this way I can create a lot of objects without setting a manual grid on them.

You just need to set the “up” of the objects’ Transform to the normal like so.

if (Physics.Raycast(ray, out hitInfo, 1000f, layerMask))
{
    obj.position = hitInfo.point; // Position
    obj.up = hitInfo.normal;      // Rotation
}

I don’t know how to snap them to the middle of a face.

I figured it out.

You get the mesh triangles hit by a raycast. Then you find the center point of the triangles hypotenuse.