Closed balloonpopper closed 1 year ago
Couldn't reproduce later on when retesting.
Code added to esc_player though in case it's needed again in future
# Ready function
func _ready():
if selectable:
._ready()
else:
tooltip_name = ""
disable_collisions(self)
# Disable collisions for non-selectable characters
func disable_collisions(node):
for current_node in node.get_children():
if current_node.get_child_count() > 0:
print("["+current_node.get_name()+"]")
disable_collisions(current_node)
else:
# Do something
print("- "+current_node.get_name())
if current_node is CollisionPolygon2D or current_node is CollisionShape2D:
current_node.disabled = true
print(" - Disabled collision")
Seems to be fixed by replacing event.global_position with get_global_mouse_position() in _on_input_event in esc_item. Currently changed in simplemouse_fixes branch.
Simplemouse fixes was merged.
Describe the bug
My player has a rather large collisionshape (as I generate one based off the left-most, top-most, right-most and bottom-most pixels of all the animation frames combined.
When I try and left click on the yellow box as shown in the picture, the click gets intercepted by the character's collision shape, the yellow box (ESCItem) click is ignored, and the click is treated like a background click.
If I have the collision polygon enabled, the click gets swallowed by the collision polygon BUT the behavior changes with resolution. I'm running my system at 1080p for video recording by my native resolution is 3440x1440. If I run at native, the problem doesn't happen. If I resize my display to match the demo I can also make it break on the demo project too (though the demo is 1200 x 900 and I need to make it 1200x960 I think based on my graphics card options). The perceived mouse click coordinates vary depending on the resolution and particularly, whether there's the windows bar at the top of the screen or not (i.e. Godot/Escoria is seeing the click location as ~40px (however big the title bar is) different to where you're clicking.) Full screen gets a different mouse coordinate.
I think it's more that there's a mouse translation going on so the coordinates are out of whack. When I'm in my usual 1440 it fits the whole game window on the screen and doesn't have to zoom the viewport to make it all fit in with the windows title bar, so everything calculates properly. When I'm at 1080p I think the screen is shown at (taking a guess) 97% of its actual size to accommodate for the title bar, and that means the mouse coordinates are off.
My guess is that when there's a collision polygon interception, the code interprets a background click and provides a scaled coordinate. With the collision polygon disabled, the coordinates are not interpreted from the mouse click coordinate, they're pulled from the item's attached ESC location directly.
To Reproduce
Expected behavior The click on the "hidden" item should work.
Screenshots If applicable, add screenshots to help explain your problem.
Versions
Additional context Add any other context about the problem here.