Find world x and z position given screen position and world y position (661696)

Hi , I need to place a book on a table, so that, after projection, the book appears in the given screen position (xs, ys).

I already know the yw (y world coordinate) the object must have, and I need to find the xw and zw.

I also know xs and ys, the screen coordinates where the book must appear after projection.

In other words, I need to find xw and zw such that (xw, yw, zw) after projection becomes (xs, ys).
yw, xs and ys are known.

I don’t think I can use Camera.ScreenToWorldPoint because I don’t know the distance from the camera. This is what I need to find :slight_smile:

Could someone kindly explain how to find xw and zw? Thank you

Do a drawing and it will be revealed

Sorry I don’t get your hint.

In the meantime, I solved the problem by intersecting the plane y = yw and a ray from the camera to a certain point (xr, yr, zr), which I obtained from (xs, ys) via ScreenToWorldPoint. Very indirect solution… Ideally I should have solved an equation.

Use ScreenToWorldPoint and the camera position to construct a Ray for use with a Raycast.

1 Like