Camera::viewport_to_world_2d
behavior on outside-of-viewport locations
#19989
Unanswered
ericseppanen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have called
window.cursor_position()
to get a logical pixel location, and then calledcamera.viewport_to_world_2d(camera_transform, cursor_pos)
to get its world location. To my surprise, that call returnsSome
even if the click is outside that camera's viewport, which is a surprise in a window with multiple cameras/viewports.Is this desirable? I would have expected
viewport_to_world_2d
to do a bounds check on the viewport, and returnNone
if the click isn't within the viewport.Is there a better way to get the mouse position within a specific camera+viewport, and ignore everything that happens elsewhere in the window?
Beta Was this translation helpful? Give feedback.
All reactions