godot-jolt / godot-jolt

Godot Jolt is a Godot extension that integrates the Jolt physics engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Small bodies sink into or hover above other bodies

beiller opened this issue · comments

When I try to add manual collision exceptions, it doesn't appear to have any effect.

On collision shape debug mode, the collision notifications (red triangles?) pop up all over things that I had configured to be exempt. I use the following pattern:

var item1: RigidBody3D = get_node("RigidBody3D")
var item2: RigidBody3D = get_node("RigidBody3D2")
item1.add_collision_exception_with(item2)
item2.add_collision_exception_with(item1)

Also I tried:

PhysicsServer3D.body_add_collision_exception(item1.get_rid(), item2.get_rid())
PhysicsServer3D.body_add_collision_exception(item2.get_rid(), item1.get_rid())

And it does not appear to be taking effect. One thing I do notice, is connected bodies by a joint of any type with exclude collisions seems to work fine! I am mostly sure it's not working but I am still testing and its difficult to test properly.

Edit-
Maybe an important note, the RigidBody3D has multiple collision shapes

Edit
Here is some testing. It seems to have an effect, but is it correct? Shouldn't the balls be perfectly aligned when collision is excepted?

no collision exception

Screenshot_2024-01-17_12-27-38

collision exception

Screenshot_2024-01-17_12-28-09

Seems to work fine for me when testing in my own scenes. Does it behave the same when you switch to Godot Physics?

If not, it would be helpful if you provided some type of minimal reproduction project.

Ya in godot physics, both the spheres are exactly on top of one another

Exception enabled

Screenshot_2024-01-17_12-35-13

disabled

Screenshot_2024-01-17_12-35-26

That's odd. If you're able to zip up that project (or some other where you can reproduce the issue) and upload it here I can take a closer look at it.

You can just drop the zip file onto the comment box, much like with the images. Feel free to omit the Godot Jolt binaries if they exceed the size limit.

PhysicsDebug.zip

Here is the project with no Jolt plugin, just Godot Physics. I saw mentioned somewhere speculative collision, could that be the cause?

Now I'm not sure, it seems okay, but not exact. Maybe that is just a difference in implementation?

The collision exceptions are working as intended, but yes, the default project settings don't work very well when you have collision shapes this small.

You'll note that one sphere is sinking into the ground, which is because the "Contact Allowed Penetration" setting is set to 0.02 by default, which is about 1/4th the size of your sphere. Setting that setting to something like 0.005 should make that less noticeable.

The reason why the other sphere is stopping before hitting the ground is indeed because of the speculative collisions (by the looks of it) which is also set to 0.02 by default. You can set "Contact Speculative Distance" to 0.005 as well and you'll see something that behaves more like Godot Physics.

See #374 for a similar issue.

I'm not entirely sure what other side effects (other than worse performance) you'll see when changing these settings. In general things are not typically tuned for objects this small, as mentioned in the readme.

I'll go ahead and close this. Let me know if changing the above mentioned settings resolves the issue for you, @beiller.