Finding nearest point

How to find out what is the closest point on a object?
I want to know the closest point on a brick (from the mouse), like this (image below), where the red dot is the closest point. When I use Collider.ClosestPoint it will only work when I got my mouse on the brick, which I don’t want.alt text
170861-naamloos.png
The final goal is to know which half of the brick the mouse is closest to, so you can place a brick next to the existing brick.

I’m using Unity 3d Version 2019.3.0f6

Have you gone through this
[Vector3.Distance]