Linear shape cast for vehicle wheels

I’m currently using PhysX 3.3 to simulate a dirtbike. I’m having a problem with the current wheel functionality (ray cast) and was curious if anyone had already solved my problem or had any tips.

Currently my vehicle is using the PxVehicleWheelData/PxVehicleTireData/PxVehicleSuspensionData for its wheel setups. By default it seems that the wheels/suspension data work off a single ray cast. This works fine for driving around on flat terrain but when we have a lot of variance it doesn’t work so well.

On the left side of the drawing you can see my current behavior. The wheel doesn’t know it has collided with a box until its ray hits it. This causes the wheel to clip through the box, then when the ray cast hits it, the wheel pops up on top.

I would prefer the right side of the drawing, where the wheel does a spherical cast and responds as soon as the front of the wheel hits the box. I have read posts where people use d6 joints to solve this problem, however none of them describe how they accomplished it. I want to make sure my solution affects suspension properly and can be driven by the vehicles engine data.

Thanks in advance!

Wheel sweeps have already been implemented for 3.4 but we don’t have a release date for that yet. In addition to sweeps, wheel rigid body contacts will have the option to be filtered by normal and position. The idea is to reject rigid body contact points near the bottom of the wheel because they will be handled by the sweep or raycast. Rigid body contact points at the front of the wheel, however, could be accepted to allow the wheel to selectively respond to the environment. It will all be explained and demonstrated with code snippets.

The workaround in the short-term is to add some extra collision geometry at the front and/or side and/or rear of the wheel. The key thing is to make sure that the extra geometry is high enough off the ground to avoid it interfering with the suspension system. This solution has been adopted by many customers with good success.

I put together a quick diagram to show you how it might work

I hope this solves your problem.



Thanks Gordon,

I gave that a shot, it improves the effect for running into an object such as a wall, but when rolling on and off an object with a sharp edge it has some abnormal behavior (imagine the wheel rolling on/off the edge of a box).

I’m looking forward to the new release with sweeps.


Is the problem now that you are picking up contact normals facing downwards from faces on the extra geometry? This has a simple solution using the sdk contact modification feature.

It is not too hard to set up contact modification so that a callback fires every time a contact on a selected object is reported . SnippetContactModification in 3.3. is a good introduction to this topic. The idea would then be to reject contacts involving the “extra geometry” based on the contact normal. I’m guessing you want to keep contacts that point along the forward direction of the car but reject contacts that are pointing downwards relative to the car’s forward direction.