NVIDIAGameWorks/PhysX

PxControllerDesc::scaleCoeff clarification

karjonas opened this issue · 3 comments

It says the following in the documentation:

"
Scale coefficient for underlying kinematic actor.

The CCT creates a PhysX's kinematic actor under the hood. This controls
its scale factor. This should be a number a bit smaller than 1.0.

Default: 0.8
"

I tried setting it to 1.0 and it seems to work fine, so what is the reason that you should scale the underlying kinematic actor?

It has to do with how the character interacts with dynamic rigid bodies around it (like pushing them, etc).

With a scale factor < 1, the underlying kinematic actor will not touch surrounding rigid bodies - they will only interact with the character controller's shapes (capsules or boxes), and users will have full control over the interactions (they will have to push the objects with explicit forces themselves).

With a scale factor >=1, the underlying kinematic actor will touch and push surrounding rigid bodies based on PhysX's computations, as if there would be no character controller involved. This works fine except when you push objects into a wall. PhysX has no control over kinematic actors (since they are kinematic) so they would freely push dynamic objects into walls, and make them tunnel / explode / behave badly.

With a smaller kinematic actor however, the character controller's swept shape touches dynamic rigid bodies first, and can apply forces to them to move them away (or not, depending on what the gameplay needs). Meanwhile the character controller's swept shape itself is stopped by these dynamic bodies.

Setting the scale factor to 1 could still work, but it is unreliable. Depending on FPU accuracy you could end up with either the CCT's volume or the underlying kinematic actor touching the dynamic bodies first, and this could change from one moment to the next.

Thanks for the clarification