Empty scene : get mouse position in scene

I am brand new to unity.

I am trying to create a simple application which will allow me to place objects in the world.

Right now my scene is totally empty, no planes no objects etc. What I would like to do is cast a ray from my camera and have it tell me the mouse position in the 3D world when I hit Y=0, so basically just the X and Z co-ords in the scene (so that I can place an object there).

I imagine I could place a plane the size of the scene and have a ray collide with it? (Or have a plane the size of the viewport follow my camera and collide with that) but I’m hoping to avoid objects that need to be collide with if possible.

Thanks.

If you’re using the built in raycasting system then you will need a collider for the ray to collide with to do what you are describing.

However you are perfectly able to not use the default raycasting, you could just take the ray, and instead of casting it through the physics system, just manually step along the ray until your y value is 0. However if you’re just trying to cast the touch into the world onto the “floor” then I suggest just using a large plane placed on the floor and using the Physics raycasting.