Hey everyone! I have problem with converting screen point to world position.
What is given: there are two 3D models on the left and on the right.
What I want: I click on the left model and it disappears.
What solution I see: convert the mouse coordinate into world coordinates and shoot the ray into depth, the first intersected object with a collision shape will be necessary.
What troubles I have: I used the script from the example for transforming coordinates, but the output is small numbers and the point is always approximately in the center. (Screen to World)
After experiments, I realized that if I give the camera an orthographic projection, the points become more or less plausible. Objects are selected incorrectly if they are nearby, but if you click in an empty area, nothing happens. In perspective projection it was selected even if you clicked on an empty space.
What could be the solution to this problem? How can you correctly determine which item you clicked on? Important point! You can click the mouse anywhere on the screen, not the center. And I would like a perspective projection.
2 Likes
Thank you! This solution helped me.
1 Like