bepu / bepuphysics2

Pure C# 3D real time physics simulation library, now with a higher version number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unstable Compound-Compound Collision

felix-ri opened this issue · comments

I have a Compound shape of 8 boxes. When stacking multiple of them, the resulting stack wobbles around like crazy.

I tried modifying the Solver and Velocity Iterations, the TimeStep and the Spring Frequency.
With some values, it was somwhat stable, but increasing the Timestep or Substeps made it wobble again.

What influences Compound-Compound Collision stability?

Demo is here

This is primarily caused by a weakness in nonconvex contact reduction. That compound has a lot of small scale complexity such that there are many choices of contacts that are very similar in heuristic quality. Small changes in the source convex contact manifolds can cause large changes in the final nonconvex manifold, and the discontinuity of those changes makes it extremely difficult to find a stable solution for a stack.

The main workaround for this would be to simplify the compound. Ideally, that whole structure would be represented by one box, but anything which makes the contact surface less ambiguous (like fewer coplanar contributing shapes) would help.

Another contributing factor is that the shape is very thin. While using continuous collision detection, stiff contacts, and higher maximum recovery velocity (with appropriate solver settings to retain stability) will help avoid penetration, sufficiently strong impacts will risk compounds getting children stuck between another compound's children. To help avoid this, you can expand adjacent children into each other so that there's not a local minimum to get stuck in:
image

The real solution is for me to improve contact reduction. It's been on the todo list for a while; at the moment, no collision pair is allowed to use historical data, so explicit hysteresis isn't possible. That makes maintaining temporal coherence extremely hard in these sorts of situations. I can't say with certainty when I'll get to this, but I'd like it to be in 2.5. Convex hulls, even not in compounds, would also benefit a lot from this.

i've had success wiht this blue highlight way to get to "not stuck " but i use triangle primitives and old decomposers, which are really prone to sticking because they can make shards .. in fact i think tesselation should be voronoi ike, less sharp pieces, and i have to hand edit such overlaps in maybe of my rigid bodies, when feet get stuck in ground because i am using an older engine. . Anoteh idea i had, is or adding tempoary one side slop fixtures on pairs that are categorized to just the pair, might help, especailly when you have joints that are being solved. that fight with the collision solver. ( self sticking rag dolls) ( the side away from the collision direction is fattened away from the incoming in its rest frame) .. auto overlap slop in inner tesselation might also help, if it doesnt go ouside the concave hull. in the case of a terrain you dont even need CCD or "bulletting" if you have enough overlap.

partially related question: ¿soft overlaps are supported? I mean: when two objects overlap a contact pair is created, and the collision respose is based on it. soft materials "modulate" the collision response based on the penetration depth, which allows object to penetrate a bit. The pros are that since the collisions responses are smaller, it has the effect of smoothing the jitter, the cons are that it produces lots of collision pairs.

Extending the colliders into the other ones indeed helped massively with stability.

partially related question: ¿soft overlaps are supported? I mean: when two objects overlap a contact pair is created, and the collision respose is based on it. soft materials "modulate" the collision response based on the penetration depth, which allows object to penetrate a bit. The pros are that since the collisions responses are smaller, it has the effect of smoothing the jitter, the cons are that it produces lots of collision pairs.

You can do this, yes- contacts have spring settings. The type of jitter it helps with is primarily a lack of convergence in the solver. It may help smooth out this kind of contact instability a little bit too, but probably not as much.