[V1] Collision between two convex colliders

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
snoopyuj
Posts: 6
Joined: Fri Jun 22, 2018 9:33 am

[V1] Collision between two convex colliders

Post by snoopyuj »

Hi all,

First, thank you @Norbo for creating the most powerful open source physics engine.
Really appreciate!

Straight to the point:
I found there has a gap between two convex colliders when they contact each other.
Like this:
Image

Mobile mesh collider also has this problem, too.
Did I miss something in doc?

Thanks!

p.s. Sorry for my bad English :(
I can't even express my gratitude to @Norbo
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: [V1] Collision between two convex colliders

Post by Norbo »

You're welcome :)

This is (probably) the collision margin. v1 uses an algorithm called GJK for shallow collision detection between many shape types including convex hull pairs. Standard GJK only works with separated objects, so the collision margin is used to keep the shapes apart. You can think of it as adding a little bit of rounded 'padding'.

You can change the collision margin by setting the shape's CollisionMargin property. If not directly set, it uses CollisionDetectionSettings.DefaultMargin, which defaults to 0.04. For smaller objects or simulations, that can produce excessively large gaps.

You can reduce the collision margin to 0, but performance and quality may suffer a little bit. Collision detection would be forced to fall back to a different algorithm.

(As a side note, v2 doesn't have shape-modifying collision margins.)
snoopyuj
Posts: 6
Joined: Fri Jun 22, 2018 9:33 am

Re: [V1] Collision between two convex colliders

Post by snoopyuj »

Thank you so much!
I feel so embarrassing that I didn't see this setting in code. :oops:
Post Reply