Is it possible to project the position of the mouse on the screen onto the xoz plane based on the camera’s perspective, instead of using scene.pickWithRay, as there may not be a ground in my scene? Additionally, I need to draw a line with height and use a circle to display the current mouse position in the scene. When the height is 0, the display is fine, but when the height is not 0, it is difficult for me to handle the ground projection position and display the circle. How can I do this
1 Like
One way would be to use a huge ground plane anyway, and disable it so it doesn’t have rendering overhead.
and then you can use that for picking and then increase the y value of the picked point to whatever height you want : O
like so
4 Likes
And if you really want to pick the XZ plane without any mesh, you can use your best friend, Thales
direction
is the pick ray, of lengh one, in green in my drawing- to retreive the point on the ground, you just need to scale it by a factor of
camera.position.y/Math.abs(direction.y)
, and add it to camera pos
4 Likes