-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Ridiculous Physics CPU Spike with multiple CharacterBody3D colliding with each other #78895
Comments
Convex shapes generated by that function are NOT simple, can have thousands of vertices! Use a sphere or a box instead EDIT TO ADD: duplicate of my own issue but I can't find the number now |
This comment was marked as outdated.
This comment was marked as outdated.
My bad, looked through your code and saw ridiculously large collision shapes but running the project those weren't used, reopening |
Since you tested with simpler shapes as well I assume this is actually related to using |
This is still a duplicate of #48587, as the underlying cause is the same (see the linked duplicate issues on that issue). The other issue's title should be changed as it doesn't just affect complex convex shapes, but any convex shape really. |
Gotcha! Didn't see any mention of this simple shapes (28 points) on that one |
Godot version
4.1 rc2
System information
Godot v4.1.rc2 - Windows 10.0.19043 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 31.0.15.1694) - AMD Ryzen 7 1700 Eight-Core Processor (16 Threads)
Issue description
I found this problem when testing the possiblity of using CharacterBody3D directly as my game object's physics.
I was attempting to make 4 objects with 'CharacterBody3D' as root and a simple convex collision3d shape generated from in-game model preview(view-> generate simple convex blahblah) convex generation function, I made them all move towards to a fixed Vector3 point in game space, after a few seconds of moving, they finally run into each other and begin to collide, then the physics frame uses up all CPU time and take like 300-500ms per process, which is ridiculous with only 4 objects.
Also I tried with a simple CharacterBody3D and the terrain as convex Static3D object, it randomly spikes too, but it's not as 100% reproducible as the one with 4 CharacterBody3D objects I just posted. So I only posted this one.
Here is a video recording the problem and the profiler view:
https://github.com/godotengine/godot/assets/35385424/cfed1528-5b35-41ed-88a5-10e7eff5e96f
Tried changing the CharacterBody3D's inspector setting from Grounded to Floating, and tried to turn on the 'Run Physics on a separated thread' option, but neither worked, it will end up like 1-2FPS with 500ms physics time eventually upon collisions.
Tried searching a bit but didn't find a similiar issue, lemme know if this is already reported, and please close this one if it's known issue/being fixed.
Thanks.
Steps to reproduce
Just run the minimal project in the attachment and click 'Run' button.
Check Debugger->Profiler->Start to see the physics frame time sky-rocket ing from 10ms to 500ms -.-
Minimal reproduction project
physics-spike.zip
The text was updated successfully, but these errors were encountered: