-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Changing Area2D shape causes resend of body_exited and body_entered for enclosed body #19271
Comments
It's likely because it recalculates the whole thing again. Once size is changed, not really sure if it can even be fixed. |
Recalculate doesn't mean to resend the signals to the objects that have already been notified. I could try to fix it but I would like to discuss it first. |
Is what usually happens, not what is expected. |
It seems old, is there some problems with fixing it. Why has it not been fixed yet.? |
I looked in the code and I couldn't find any clue on where could this bug be. Probably it is the part that calls update() in the CollisionShape2D::shape_changed() method. |
Confirmed in the current master branch (c4234b1), made this reproduction project: area2d_shape_resize.zip |
I have a similar problem. I use KinematicBody2D with 2 shapes, one of which is disabled. When I disable one and enable another, any area the body is in gets EDIT:
|
For the record, I checked if #33615 fixes this but it doesn't. |
Disabling a CollisionShape2D also triggers the exited signal, which it probably should not. Caused some weird bugs in my game, luckily i had a comment in my code that saved me lots of debugging time! |
Still valid in 3.2.4 beta4 |
As I mentioned here: #14578 (comment), one workaround is to reconnect the Something like: |
Using this reproduction project, I was unable to reproduce it in v4.0.stable.official [92bee43]. |
Godot version:
3.0.2-stable
OS/device including version:
Ubuntu 18.04 bionic
Issue description:
If a body x is inside an Area2D (I mean the Area2D already received the body_entered(x)) and you resize the Area2D shape in such a way that the body is still inside the shape, it triggers body_exited(x) and then body_entered(x), like if the Area2D or the shape were being deleted and created again.
¿Is this the expected behavior?
I think that the body_entered and body_exited should be called only once in this case (i.e the body have never exited the area)
Steps to reproduce:
I have something like this:
This Area2D has an script that updates the rectangle with the mouse dragging (like a rectangle selection)
In the other hand I have a KinematicBody2D with a rectangle shape:
The unit code is this:
To test it you can put this nodes in a parent Node. You will have to draw a rectangle that overlaps the KinematicBody2D and see how it prints false -> true -> false -> true infinitely while the rectangle is being resized.
The text was updated successfully, but these errors were encountered: