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

Removing collision does not update Area2D #290

Open
Changryy opened this issue Oct 21, 2024 · 0 comments
Open

Removing collision does not update Area2D #290

Changryy opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Changryy
Copy link

Describe the bug

If you remove a collision shape that is a child of an Area2D while that collision shape is overlapping with other bodies, the Area2D will keep reporting that those bodies are inside it.

To Reproduce

Steps to reproduce the behavior:

  1. Add an Area2D with a collision shape or polygon
  2. Add any type of body and make sure it overlaps with the area
  3. During runtime remove the collision shape of the Area2D. This can be done by either area.remove_child(collider), collider.queue_free() or collider.disabled = true
  4. Area is still overlapping with the body despite having no collision shape

Expected behavior

When a CollisionShape2D or CollisionPolygon2D is disabled or removed from an Area2D the bodies that were inside that collision shape should no longer be in the array returned by get_overlapping_bodies(). For each body that was previously inside said collision shape the area should emit the body_exited signal. This of course does not apply if the area is still overlapping with those bodies through a different collision shape.

Environment:

  • OS: Windows 11
  • Version: 0.8.8
  • Godot Version: 4.3
  • Type: simd single 2d

Example project(zip)
AreaBug.zip

@Changryy Changryy added the bug Something isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant