How to use Continuous Collision Detection in PhysxSDK3.x ???

the method in SDK Documentation is too fuzziness,i read it several times,but can’t understand.

I refer to do the first three steps.

but,the following steps are difficult to understand.

{

isMovingFast = smallest < ( (linearVelocity.magnitude() * a + angularVelocity.magnitude() * b * largest ) * dt )

smallest = bounds.halfDimensions().smallestDimension()
largest = bounds.halfDimensions().largestDimension()

a = sweptIntegrationLinearSpeedFactor
b = sweptIntegrationAngularSpeedFactor
}

The answer depends on which version of the SDK you are using. If you are using PhysX 3.2 or above, the good news is that the CCD will actually determine appropriate thresholds for you so that you don’t have to do anything other than enable CCD. These thresholds are determined based on the actual shapes involved (rather than their bounds) so they don’t require any user-configurable coefficients.

However, if you are using a release prior to 3.2, you may potentially have to adjust the sweptIntegrationLinearSpeedFactor and sweptIntegrationAngularSpeedFactor. The deafault values of 2.0 are generally good enough for most use cases but there may be cases where you want to adjust these coefficients. If you increase these coefficients, you decrease the speed at which the shapes are considered to be moving fast (so CCD is enabled). Similarly, if you decrease these coefficients, you are in effect making the shapes have to move faster before CCD becomes enabled.

The reason why these coefficients exist is that the CCD thresholds in releases prior to PhysX 3.2 are calculated based on the speed of the objects relative to their bounds. While the bounds are generally a good approximation to a shape (especially when the shapes in question are primitives like boxes, spheres etc.), there are cases where the bounds of an arbitrary convex hull may not tightly fit the convex hull itself. This would mostly be the result of the convex hull being modeled in such a way that it does not align up with the principal component axes (X-, Y- and Z-). In this case, the default values may result in collisions being missed because the shape is considered not to be moving fast when, in fact, it is moving fast enough to miss collisions. These are the circumstances in which you may need to adjust these coefficients. However, unless you are observing issues like this, you can probably leave the default values as they are.

Hope this helps

Kier

You only need to do the first 3 steps and PhysX will take care of CCD for you.

That formula is just to explain that CCD will be applied if your object is moving faster than a certain threshold which is controlled by the 2 PxSceneDesc::sweptIntegrationLinearSpeedFactor and PxSceneDesc::sweptIntegrationAngularSpeedFactor. Else normal collision will be used as your object is moving slow enough.