godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.22k stars 21.22k forks source link

area_entered and area_exited emitted multiple times while still overlapping #35595

Closed shafy closed 3 years ago

shafy commented 4 years ago

Godot version: 3.2rc1

OS/device including version: MacOS 10.14.3 (Mojave) build running on Oculus Quest.

Issue description: area_entered and area_exited signals are emitted all the time when one area is moved even though areas are still overlapping (for 3D). This only happens when the CollisionShapes are sufficiently small.

Steps to reproduce:

Minimum reproduction project: Not sure how much it helps since you need a Quest to run it: https://github.com/shafy/blocks-kosmos-school/

Grab one of the blocks on the table and hold one of the small six Areas into another block's to see what I mean.

Calinou commented 4 years ago

Please upload a minimal reproduction project to make this easier to troubleshoot. Thanks in advance :slightly_smiling_face:

shafy commented 4 years ago

Thanks @Calinou, I updated the comment. Not sure how much it will help since it's a Quest app :-)

creikey commented 4 years ago

When collisionshapes are especially small the physics engine ( bullet ) will start to have problems unless you adjust the margin property of the collision shape.

shafy commented 4 years ago

You mean I need to increase the margin?

creikey commented 4 years ago

@shafy yes

shafy commented 4 years ago

Ok, but this is then the same as just increasing the volume of the collision shape. So it doesn't really solve the problem then. But I guess there's nothing we can do about it if it's beause of Bullet?

pouleyKetchoupp commented 3 years ago

Does it work as expected if you switch the physics engine to Godot Physics? Project Settings > Physics > 3D > Physics Engine > Godot Physics

shafy commented 3 years ago

Thanks @pouleyKetchoupp. I'm currently not working on that project anymore and so won't be able to test this any time soon. But I'll let you know once I can. Or maybe someone else who has a similar problem can check it?

pouleyKetchoupp commented 3 years ago

Alright. If anyone can reproduce a similar issue, please test with Godot Physics and share a minimal project to help investigate.

SoapSpangledGames commented 3 years ago

I don't have a minimal project, but my larger project exhibited similar behavior with Godot 3.2 and 3.3.2 official builds. In my case, area_exited fired twice for each object. My issue involves collisions with a small box [extents (0.507,0.532,0.612), margin 0.04] and a cylinder (radius 1, height 2, margin 0.04). This happens under Godot Physics and Bullet physics.

After struggling with this for days, I ended up making the cylinder longer (height 5.07). This fixed the problem for me under both physics engines.

pouleyKetchoupp commented 3 years ago

@SoapSpangledGames Thanks for info! Would you be able to check if your issue still occurs in 3.4 beta by any chance?

SoapSpangledGames commented 3 years ago

I am unable to reproduce my problem in 3.4 beta 5. I was mistaken about the signal I was using. I was using body_exited, not area_exited. But the issue was correct, and I'm unable to reproduce it now. It seems to be fixed in 3.4 beta 5.

pouleyKetchoupp commented 3 years ago

Closing for now since it seems fixed in 3.4.

@shafy Feel free to re-open if you can still reproduce the issue when you get to test this project again.

Calinou commented 2 years ago

@jeudy-ua Please open a new issue with a minimal reproduction project attached.