PhysX 3.4 - Can the forward direction of a wheel be different than other wheels?


I’m working with a vehicle that needs wheels to be able to have different forward directions from one another at certain points. Is this feasible?

I just want to make sure that I understand the question: do you mean that you want the wheels to have different steer angles? For example, you want the front left wheel to be steered at 15 degrees and the front right wheel to be at 8 degrees? This would give the front wheels different forward directions at zero steer.

You can have different steer angles by setting different toe angles. You can set the toe angle after you’ve created the vehicle and modify it at at any point in the simulation but not during a simulation step.

Something like this:

PxVehicleWheelData wheel = myVehicle.getWheelData(wheelId);
wheel.mToeAngle = 0.1f;//around 5.7 degrees
myVehicle.setWheelData(wheelId, wheel);

wheel = myVehicle.getWheelData(anotherWheelId);
wheel.mToeAngle = 0.2f;//around 11.4 degrees
myVehicle.setWheelData(anotherWheelId, wheel);

In principle the car could be steered just by setting the toe angle each simulation step, provided you make sure to set the Ackermann accuracy to 0.0.

I’ve got the toe angle working, but I think I’m looking for something slightly different.

I’ll give you an example. We have a one-sided wheel model (not a mirrored mesh), that we have attached to a vehicle. If I change the toe angle to 180, the mesh will appear correctly on the model once the simulation starts, but the wheel local forward direction has not changed, which means that any wheels with that toe angle spin in the opposite direction of the others. I suppose a better way of framing the question is whether it is possible to change to the spin direction of an individual wheel?


And I realize that I could get around this particular example with a mirrored mesh, but I’m just wondering if it is possible to do such a thing!

Thanks for the clarification. I definitely understand the question now.

The vehicle sdk does not directly support this feature. It assumes that all wheels are oriented around the same direction when it computes the local pose of the shape.

It is still possible to do what you want but it would require custom code to recompute the poses after PxVehicleUpdates() is complete.

Unless I’m mistaken you want to rotate the local pose of the corresponding PxShape by Pi around its up vector. I think this will swap the handedness of the wheel.

The function poseWheels in PxVehicleupdate.cpp illustrates how to get the PxShape that corresponds to a wheel id and also how to set the local pose. If you’re interested in how the local poses are computed from steer/camber/etc then take a look at computeWheelLocalPoses in PxVehicleUpdate.cpp.


Thanks for the clarification, Gordon!

I’ll take a look at the code you suggested, and will follow up with a new question if I have additional issues.