Skip to content
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

The CollisionObject2D in the Child Window node does not respond to any _input_event signals. #91667

Closed
Yanxiyimengya opened this issue May 7, 2024 · 6 comments

Comments

@Yanxiyimengya
Copy link

Yanxiyimengya commented May 7, 2024

Tested versions

v4.2.2.stable.official [15073af]

System information

Godot v4.2.stable - Windows 10.0.19045 - GLES3 (Compatibility) - AMD Radeon(TM) Graphics (Advanced Micro Devices, Inc.; 30.0.13014.10001) - AMD Ryzen 5 5500U with Radeon Graphics (12 Threads)

Issue description

After creating a Window node, I put an Area2D with CollisionShape2D under the child node of the Window, but Area2D does not trigger _input_event, mouse_entered, etc
Area2D's input_pickable is still false, and Button inside WindowViewport will still trigger the "pressed" signal normally
Area2D has a handle_input_locally property of true and has a default collision level.

Steps to reproduce

MainScene Script:

extends Node2D

const AREA : PackedScene = preload("res://Area.tscn");
func _ready():
	
	get_viewport().gui_embed_subwindows = false;
	
	var window : Window = Window.new();
	self.add_child(window);
	window.position = Vector2(get_window().position);
	
	window.add_child(AREA.instantiate());
	
	pass;

res://Area.tscn :

extends Area2D;

func _on_mouse_entered():
	print("test")

The console doesn't output anything, is this a bug???

Minimal reproduction project (MRP)

Demo.zip

@AThousandShips
Copy link
Member

You deselected the field while it was still uploading, please edit your post and upload the MRP again, making sure you leave it open until it's fully uploaded

@Sauermann
Copy link
Contributor

Have you set physics_object_picking = true?

@Yanxiyimengya
Copy link
Author

您是否设置了 physics_object_picking = true?

Yes. They aways keep it in its default state.

@Sauermann
Copy link
Contributor

Please note, that pyhsics_object_picking has a default value of false.

I have tested your MRP and I was able to make it work by enabling physics object picking in the newly created window like this:

func _ready():
	
	get_viewport().gui_embed_subwindows = false;
	
	var window : Window = Window.new();
	self.add_child(window);
	window.position = Vector2(get_window().position);
	window.physics_object_picking = true
	window.add_child(AREA.instantiate());

Does this solve your problem?

@Yanxiyimengya
Copy link
Author

请注意,其默认值为 。pyhsics_object_picking``false

我已经测试了您的 MRP,并且能够通过在新创建的窗口中启用物理对象拾取来使其工作,如下所示:

func _ready():
	
	get_viewport().gui_embed_subwindows = false;
	
	var window : Window = Window.new();
	self.add_child(window);
	window.position = Vector2(get_window().position);
	window.physics_object_picking = true
	window.add_child(AREA.instantiate());

这能解决您的问题吗?

Thank you, it was really my mistake, thanks for the answer

@AThousandShips
Copy link
Member

Closing as per above as this was not a bug, thank you for your report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants