-
-
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
CanvasLayer's Follow Viewport doesn't translate inputs correctly #35965
Comments
I'm experiencing this bug, separately, in my project. (3.2, MacOS) |
Same issue here, using 3.2.1 |
This comment has been minimized.
This comment has been minimized.
@Calinou , do you think you can you help me to know where this needs to be changed? I can make a PR for that, just need some orientation. |
@renatodex I don't know why this bug happens, but the CanvasLayer source code is here: https://github.com/godotengine/godot/blob/master/scene/main/canvas_layer.cpp Either way, it's not like having Control nodes in a CanvasLayer that simulates a pseudo-3D effect is exceedingly common 🙂 If you just want Control nodes to follow the camera as it moves, use a CanvasLayer without enabling Follow Viewport. |
@renatodex Disregard my deleted comment. I forgot what this was about.
I think the camera2D's transform applied on the canvas seems to be the issue. func _ready():
var viewport :Viewport = get_viewport()
viewport.canvas_transform = Transform2D(0, Vector2(100,100)) You get the same error as above. Therefore, it would seem that the viewport's canvas_transform is not being applied to the input events being passed to a canvas layer? Maybe? |
Looks like it could be related to Ref<InputEvent> CanvasItem::make_input_local(const Ref<InputEvent> &p_event) const {
ERR_FAIL_COND_V(p_event.is_null(), p_event);
ERR_FAIL_COND_V(!is_inside_tree(), p_event);
return p_event->xformed_by((get_canvas_transform() * get_global_transform()).affine_inverse());
} Which, if my tired brain is correct, it shouldn't apply the canvas transform AND the global transform if it's layer is set to "follow viewport"? Maybe? I should get some sleep then come back to it... |
I'm having the same issue in 3.2.3 :/ |
Still relevant in 3.3 |
And I believe it will be for a long time, so the best option so far is to
workaround
Em seg., 26 de abr. de 2021 às 19:40, Gabriele Torini <
***@***.***> escreveu:
… Still relevant in 3.3
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35965 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQXGZCXKZMSVPM7WYVHB3TKXTXPANCNFSM4KREVKHQ>
.
|
Here is a MRP for Godot 4: BugCanvasLayerFollow.zip |
I'm having this issue in 4.0.3 |
Godot version:
3.2
OS/device including version:
Windows10
Issue description:
Turning on
Follow Viewport
Enable
on aCanvasLayer
translates child controls to the right place, but inputs are triggering in the non-follow spotSteps to reproduce:
In a Node2D scene, add a centered Camera2D set as the current camera
Add a
CanvasLayer
withFollow Viewport > Enable
set to trueIn the
CanvasLayer
add a buttonHit play. The button will get hover and click events when the mouse is in the top left corner of the screen instead of when the mouse is over the button
Minimal reproduction project:
https://github.com/cgbeutler/FollowViewportBug
The text was updated successfully, but these errors were encountered: