-
-
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
[Bullet] Severe lag when adding a collider to a physics object with many colliders #22064
Comments
Can you update a sample project please? |
EDIT: I don't know how accurately this test project shows the problems, my main project uses a custom concave mesh generated from code which would be a lot of work to try to slim down to a minimal reproduction project. ConcaveRegressionTestProject.zip I'm getting different and weird errors with the latest master. Concave seems to be able to collide with other objects (most of the time...?). (Note: The concave collision shapes are just test points and don't represent the cube perfectly) For anything set to "Kinematic":
For RigidBodies set to Kinematic, they simply don't move. At all. Not by user code or anything. See the example on the far left in the test project. RigidBodies with Concave colliders are not able to hit other Concave colliders. See the example in the middle-left in the test project. They just phase through each other. RigidBodies with Cube colliders are able to hit RigidBodies with Concave colliders. See the example in the middle-right in the test project. But sometimes, they both disappear on contact. I also get inconsistent results when a Concave collider spawns inside of another one. With the example in the middle, sometimes these objects disappear immediately, sometimes they don't. And of course, Cube colliders can still collide with each other. I added this as an example just to prove that physics does work in this project. See the example on the far right in the test project. Here's what it looks like after a few seconds on my system: But sometimes this happens and they disappear (ZERO code has been changed): |
Concave can't be used as movable objects, so it's expected
…On Sun, Sep 23, 2018, 06:52 Aaron Franke ***@***.***> wrote:
ConcaveRegressionTestProject.zip
<https://github.com/godotengine/godot/files/2408410/ConcaveRegressionTestProject.zip>
I'm getting more and weird errors with the latest master. For anything set
to "Kinematic":
WARNING: copyAllOwnerShapes: This shape is not supported to be kinematic!
At: modules/bullet/rigid_body_bullet.cpp:243.
WARNING: copyAllOwnerShapes: This shape is not supported to be kinematic!
At: modules/bullet/rigid_body_bullet.cpp:243.
W 0:00:00:0891 This shape is not supported to be kinematic!
<C Source> modules/bullet/rigid_body_bullet.cpp:243 @ copyAllOwnerShapes()
<Stack Trace> :0 @ void Godot.NativeCalls.godot_icall_2_363(IntPtr , IntPtr , IntPtr , Boolean )()
Node.cs:309 @ void Godot.Node.AddChild(Godot.Node , Boolean )()
TestRigidBody.cs:18 @ void TestRigidBody._Ready()()
For RigidBodies set to Kinematic, they simply don't move. At all. Not by
user code or anything. See the example on the far left in the test project.
RigidBodies with Concave colliders are not able to hit Cube colliders or
other Concave colliders. See the example in the middle-left in the test
project.
However, RigidBodies with Cube colliders are able to hit RigidBodies with
Concave colliders. See the example in the middle-right in the test project.
I also get inconsistent results when a Concave collider spawns inside of
another one. With the example in the middle, sometimes these objects
disappear immediately, sometimes they don't.
And of course, Cube colliders can still collide with each other. I added
this as an example just to prove that physics does work in this project.
See the example on the far right in the test project.
Here's what it looks like after a few seconds on my system:
[image: test]
<https://user-images.githubusercontent.com/1646875/45924301-cace7780-beca-11e8-97d3-0baeb631983f.png>
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#22064 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH9MR24lQ1c0zv3Jf25IpB-lqrc7si1rks5udxN7gaJpZM4Wo6O8>
.
|
It used to work just fine though (not everything in the test project, just one specific thing), therefore it is a regression. In my main project I have a single movable concave object which collides with my character in Godot 3.0 but disappears with the latest master. (When I say 3.0 I'm actually testing ec4b8e4 but I assume it applies to 3.0 as well since it has worked for a long time for me) I can identify two specific regressions in my main project:
Also, sometimes the above problems will crash Godot entirely (not just the running project) (segfaults). |
Can you please try to change RigidBody with StaticBody for all bodies that use concave shape? |
I need my concave objects to be able to move around. StaticBody does not do what I need. |
Check this please: #22064 (comment) |
Note: Depending on the type of shape that you need you can recreate it using primitive shapes |
I've used concave shapes for kinematic bodies in Godot 3.0 and in Unity without issues. |
I haven't experienced any crashing or errors as before and Concave colliders seem to work so far but I still get warned with Concave being unsupported with KinematicBody (as you said it was). I tried replacing the Concave collider with individual BoxShape Colliders for my generated voxel object. I generate on a per-chunk basis then check how much time has elapsed to decide whether or not to generate another one. Also, I'm using C#, and I've tested both Alpha 1 and the master branch.
It's probably a bug in its own right, but this wouldn't be a problem if KinematicBodies officially supported Concave shapes without throwing warnings. |
Mostly because move a concave shape is not an optimal operation we have this restriction. However, there are physics engine that supports this feature, but unfortunately bullet doesn't. However, add a new shape (especially a box shape, should not impact performance) so this is something to address. |
@AndreaCatania Yeah, ignore my original request, concave isn't the solution (even if it used to kinda work in 3.0), I just need the ability to build compound colliders without severe lag. For compound colliders, see godotengine/godot-proposals#535 For the severe lag, I'll rename the title of this issue and edit the OP to just reflect that. But also, the weird behavior and random crashes mentioned in this post likely still need fixing - it should be at least consistent. |
@aaronfranke Could you please provide a MRP for this issue? I suspect this issue is specific to Bullet and similar to the scenario from #45360 but I can't confirm without an actual test case. |
@pouleyKetchoupp Here is a minimal reproduction project (for 3.x), it slows significantly after 1000, and it's crawling at 2000. The framerate at any given shape count is about 1/5th of what it is at half that shape count. My expectation would be that it's a linear relationship (or better). 22064-MRP.zip Also, check out the Voxel demo from the Godot demo projects repo. Adding the colliders as children is very slow there too. It's not as significant as the MRP because each chunk is its own StaticBody so each StaticBody deals with less shapes. To push the Voxel demo to its limit, disable VSync, then try the following (not at the same time):
|
@aaronfranke Thanks for the repro cases! I can confirm that in both cases, switching to Godot Physics solves the problem. The bottleneck in Bullet is this callstack:
|
Closing as resolved due to Godot 4.x no longer having Bullet. Also, fixing this in 3.x is not very important. |
Godot version: fc50728 (#21808) and later are affected, ec4b8e4 and prior are unaffected.
OS/device including version: Xubuntu 18.04 LTS 64-bit
Issue description: EDIT: This issue has been a wild ride. I don't think concave support is the solution anymore. As mentioned in this comment, the main limitation is that I am unable to get the same level of performance using compound box colliders compared to using a single concave collider in 3.0.
When using many BoxShape CollisionShape nodes, my project gets about 1 FPS when generating, and once generated, I get about 450 FPS. If I comment out
add_child
then it doesn't lag, so it's not my game's math slowing things down, it's just adding the collider node to the object, and having the object exist with box colliders is apparently slower than Concave.However, when using a Concave collider in Godot 3.0, my project runs fine and I get about 700 FPS once it's generated. In Godot 3.1+, this spams warnings and produces weird behavior.
Steps to reproduce: See comments for more information.
CC @AndreaCatania
The text was updated successfully, but these errors were encountered: