Translating an object along a line until it collides with other objects

I have a group of gameobjects with meshcolliders stacked in a “tower”. I am looking for a way to - given a direction vector and an origin point - find the place where a new gameobject can be placed so that it collides with the meshcolliders already in the tower.

Here is an image to clarify what I am asking:

The grey shapes are objects already in the tower and the blue object is the object to be placed. Each frame I want to find this point of closest collision since the user can move around each frame.

Some ideas I’ve had is to start with the object at the camera’s position and gradually translate it along the direction vector. Between each translation, collision with the tower objects is checked.

The idea you mentioned is the best way to do it, short of a hell of a lot of pretty advanced trig. Depending on your level of precision, you might want to check out Physics.BoxCast though.