jrouwe/JoltPhysics

[Feature Request] gjk treat quadratics as polyhedrons with convex radius

Closed this issue · 5 comments

Hi,

I'm hoping there's already a way to do this, but based on what I saw while debugging the ShapeCast code it looks like when sweeping a sphere the convex radius is 0, and the sphere's support function has the radius embedded in it.

When working on past engines we've seen great stability and perf improvements by treating the sphere (and capsule) as a point (line) with a convex radius as the radius.

Is this approach supported? It seems like it should be possible based on the convex radius variables passed around, but I was seeing them as 0 for the sphere. Maybe there's a different type of sphere I am missing?

Thanks for the great library

I think you're looking for ShapeCastSettings::mUseShrunkenShapeAndConvexRadius = true.

Yes that's it, I figured there was a setting I was missing. Question - is there any reason why capsules and spheres don't always assume this is true? I get why you might not want this for convexes that have hard edges, but for quadratics is there a case where you don't want this?

I haven't run into the issues that you're talking about yet. It wouldn't be hard to change the behavior but then I would need to do some checking if there is indeed a quality / perf difference.

Hello, this is implemented now. In my tests it gave a significant performance boost.

Awesome, I did something similar in our project (more hacky than yours) for spheres and capsules. Thanks for following up