-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_local_mouse_pos() offset bug in the editor #1885
Comments
I'm not sure but I think you're confused get_local_mouse_pos () function with, get_mouse_pos () function when you specify to take the local coordinates it takes out from the node of your object instead of just the viewport, and the node they differ because that they are locally .. . |
ah there is one extra matrix you need that you probably don't have access to, I need to figure out how to get it available |
I wanted to bump this issue. Would be nice if this gets fixed for the editorplugin overhaul. And probably the same matrix as in the fix above has to be multiplied with the mouse coords: Line 1370 in 08e0e64
I get the viewport with: get_tree().get_edited_scene_root().get_viewport. |
As soon as the video was posted demonstrating the "tool" keyword at the top of the script I immediately began to perform a test and noticed the same issue. There seems to be no way to guarantee the coordinates of the mouse position in relation to the scene's global 0,0 position. Works perfectly in game mode, but not in the editor. |
@remorse107 @reduz |
What's the status on this issue? |
@akien-mga |
I don't completely understand this issue, you mention calling CanvasItem.get_local_mouse_pos() |
(cherry picked from commit b16f41a)
I try to write a small editor plugin with gdscript. In my script I need the mouse coordinates in 2d world space. There for I use CanvasItem.get_local_mouse_pos() which in general seems to work fine, but there is an offset which I think may be a bug.
Take a look at the screen attached. When I position my mouse at 0,0 the printed position is about 12,98. Which seems to be the exact dimensions of the upper left rect I illustrated.
This offset is set by a zoom of 100%. Whenn I zoom in, the offset gets smaller and when I zoom out the offset gets bigger!
The text was updated successfully, but these errors were encountered: