-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Rapid performance degradation #248
Comments
Interesting, so the intersect_ray is slow then? But only after some time, which makes me think its either memory leak or during that time more objects are closer? Havent had a chance yet to reproduce it locally, will add more info when i do. As for this bug, does it also happen with less objects? Or only with 70-ish? |
Just to check, if you remove the intersect_ray all togheter, is performance better? Or is there another bottleneck to? Edit: Thanks for reporting the bug! |
After some more testing it appears it maybe wasn't the rays that caused the problem. I changed te code so that the mobs just turn to random angle on every frame and then call move_and_slide() and that was enough to trigger it. The mobs just didn't do any turning without the rays and perhaps the rays made it worse.
More mobs makes it happen faster. With 144 units performance goes bad at ~8 seconds, with 72 it tok ~26 seconds. With 10 units I waited few minutes and saw nothing. Here new example project. |
Now that I added serialization it seems that the |
Looking at docs: https://rapier.rs/docs/user_guides/rust/scene_queries/ I am not calling Edit: No, I am calling indirectly |
This seems to be the issue: dimforge/rapier#749 |
Describe the bug
At first everything seems to work fine but after few tens of seconds performance suddenly tanks.
See the profiler graph below.
Performance is fine with default physics.
To Reproduce
EDIT: See the comment below instead. The trigger seems to be move_and_slide with rapid rotation.
Run world.tscn in the example project with rapier physics.
The scene has 72 CharacterBody2d which move around and use ray-casting (8 rays per physics frame per unit) to avoid colliding with walls and each other.
Profiler says this part is where all the time is spent.
Expected behavior
Performance stays constant.
Environment:
Example project(zip)
test_project.zip
The text was updated successfully, but these errors were encountered: