Godot Version
4.2.1
Question
First of all, this is my code.
func _ready():
DisplayServer.window_set_mouse_passthrough($Path2D.curve.get_baked_points())
DisplayServer.window_set_mouse_passthrough()
DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_TRANSPARENT, true)
Now when I run this, the screen becomes transparent, but the click doesn’t through the screen
2 Likes
I searched the web a lot, and ended up finding this solution. It seems like a terrible workaround, but it allows you to click through. I think it works by making the game window the same size as the object you pass into the method.
1 Like
i’ve been trying to figure this out as well. I’ve adjusted a lot of project settings, but cannot figure it out yet
Hey guys, this is by no mean a definite answer (I guess, because I do not test it extensively), but I made a small script that reads from a control node assigned to a group to determined clickable regions
func _process_clickables() -> void:
var clickable_nodes = get_tree().get_nodes_in_group("Clickables")
for node in clickable_nodes:
if node is Control:
var rect = node.get_rect() as Rect2
var texture_corners: PackedVector2Array = [
rect.position, # Top left corner
rect.position + Vector2(rect.size.x, 0), # Top right corner
rect.position + rect.size, # Bottom right corner
rect.position + Vector2(0, rect.size.y) # Bottom left corner
]
DisplayServer.window_set_mouse_passthrough(texture_corners)
else:
printerr(node.name + " is not a Control")
here is a demo
Edit: Dont forget to call the function on the process method so every tick every clickable is recalculated