I’ve managed to put together a car with physics by reading the vehicle tutorials. I can render the chassis well by getting the PxRigidDynamic body from the vehicle, but how would I go about rendering the wheels?
I’ve been looking at the API but can’t really find it. I also don’t know if I can get the orientation and position of the convex hulls or I should do it by getting the steering, current suspension length and rotation of the wheels (as it’s a raycast vehicle)?
How can I get these data from the PxVehicleDrive4W class?
Thank you for your help.
You can get the position and orientation of the wheel shapes ( convex hulls ) and use those to place your wheels for rendering.
There are two ways to do this:
If you’re using 3.3 then you can get the local wheel pose of each wheel using PxWheelQueryResult::localPose
An alternative technique is to a) add a PxShape to represent the collision geometry of each wheel, b) use PxVehicleWheelsSimData::setWheelShapeMapping for each wheel to ensure that the vehicle knows which PxShape represents each wheel, c) query the pose of each relevant PxShape after PxVehicleUpdates is complete. This is the solution offered by busta78 above. The function PxVehicleUpdates poses each PxShape that represents a wheel so it is straightforward to use that pose as the graphics pose.
Thank you I’ve found it, it’s:
vehicle.getRigidDynamicActor()->getShapes( carShapes, numShapes);
and the first 4 shapes in there.