NVIDIAGameWorks/PhysX

PxVehicle suspension sweeps distance

zemlifr opened this issue · 1 comments

Hello, I am using non-blocking suspension sweeps for my vehicle simulation.

Rejection angles are both set to 75°

Recently I have encountered following problem:

Frame 1

Frame 2

I don't understand why front wheel suspension selects contact with second vehicle instead of ground.
From picture it seems, that actual sweep hit was on surface of vehicle but wheel position was clamped by mMaxCompression value.

I looked into sweep code, and I have noticed that sweep start is computed as

suspStartPose.p -= suspLineDir*(radius + maxBounce);

I don't understand why wheel radius is added there. I understand why you want add radius when doing raycast, but it seems to me unnecessary there when I have actual cylinder geoetery.

Do I miss something?

The extra radius is deliberate.

If the sweep starts inside geometry it is difficult to determine the position and normal of the sweep hit. If the vehicle is placed such that the wheel is at maximum compression, the sweep will fail because the sweep will start inside geometry. The extra radius is just to add a small buffer to the sweep length so that we can successfully perform a sweep across the whole range of legal wheel positions.