Hey everyone, I am trying to forward mouse inputs on a TextureRect with a ViewportTexture to its corresponding SubViewport that has a 2D scene and Camera2D as children.
I am forwarding the input with the following code on the TextureRect and my inputs do reach the SubViewport:
func _input(event: InputEvent) -> void: if event is InputEventMouse: viewport.push_unhandled_input(mouse_event)
However the input is obviously scaled and translated wrong and that is the part that I am struggling with.
Any help would be greatly appreciated
#Transform input from a ViewportTexture to a SubViewport
7 messages · Page 1 of 1 (latest)
Put the SubViewpoint in a SubViewportContainer, and there should be an option to set "mouse filter" to "ignore"
Godot Engine documentation
Inherits: CanvasItem< Node< Object Inherited By: BaseButton, ColorRect, Container, GraphEdit, ItemList, Label, LineEdit, MenuBar, NinePatchRect, Panel, Range, ReferenceRect, RichTextLabel, Separato...
This reddit post has something that properly scales the input https://www.reddit.com/r/godot/comments/tx9x2b/a_guide_to_mouse_events_in_subviewports/
Would love to do that, however, you cannot scale SubViewportContainers below the SubViewport size. I have multiple textures in a layout and I use ratio stretch to resize them dynamically
@reef totem not sure if you missed this so I'm pinging just in case
Ah sorry, I have seen that post before and tried that implementation, but it does not work correctly
Is the scaling or offset incorrect or does it just not work in general