Capsule-Plane collision detection

Post Reply
jhwangbo
Posts: 1
Joined: Sat Dec 30, 2017 8:21 am

Capsule-Plane collision detection

Post by jhwangbo »

I have the following two issues with a capsule-plane collision.

1. I expect maximum two contact points in capsule-plane collision. But I get 4 contact points quite often when a capsule is lying on the ground.

2. The collision points are not directly underneath the centerline of the capsule. This makes a capsule accelerating forward. This does not happen when the capsule is not moving. But once it is moving, it seems like the collision detection algorithm is registering the old contact points. I have a screenshot attached. The red points are contact points.
image3344.png
image3344.png (109.34 KiB) Viewed 2600 times
Thank you for your answers in advance!
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Capsule-Plane collision detection

Post by Erwin Coumans »

Bullet uses contact caching for various combinations of collision shape types. This cache allow to accumulate multiple contact points, even when using a collision detector that only computes a single points (such as GJK/EPA). Secondly, this caching allows to store solver information for warmstarting (previous frame collision impulse).

Some heuristic is used to add and remove points from the contact cache, and those rely on tolerances.

The implementation is in btPersistentManifold.

Some suggestions:
+ You could tweak the tolerances (global variable gContactBreakingThreshold) or modify above btPersistentManifold code
+ Add enough rolling friction so that the capsule looses the energy (instead of accelerating forward) due to this contact imprecision
+ Enable perturbation threshold to compute multiple contact points at once (GJK/EPA only computes a single point)
+ Register a collision algorithm that drops all existing contact and recomputes all contact points
Post Reply