can i make a raycast only detect one collider? C Sharp

Hey, so i want to use a raycast to place an object on the mouse position, bot only on the ground, despite there is an object in the way. for example i would like to place an object behind a tree, on the ground, could i make it so it only detects the ground and does not stop at the tree?

The easiest and most efficient way to do this is to use Collider.Raycast(). This will raycast using a specified collider only. An alternate solution is to put the ground on a separate layer and use a layer mask in the Physics.Raycast().