Here I add my vehicle actor to my scene
auto vehActor = createVehicleActor(data, wheelMats, wheelConvexMeshes , 4, chassisMats, chassisConvexMeshes, 1, *physX);
physXScene->addActor(*vehActor);
if I comment the addActor call, I get a physX error.
Inside the createVehicleActor method I do this
PxRigidDynamic* vehActor = physics.createRigidDynamic(PxTransform(PxIdentity));
I traced that and saw that physX automatically adds the vehicle actor to the scene, as far as I know, this might be the reason I have two vehicles, but since I don’t know another way to make a PxRigidDynamic, it kinda seems necessary.
Another issue that I have is that I set my latency on my autobox on 3 seconds, but when I fetch the value
again it reads 0.5 seconds, which is too close to the switch time of my gears, so my vehicle gets stuck between neutral and first. I don’t know why it doesn’t take my value, any clues?
PxVehicleAutoBoxData autoboxData;
PxReal lat = 3.0f;
autoboxData.setLatency(lat);
for (PxU32 i = 0; i< numberGears; i++)
{
autoboxData.mUpRatios[i] = 0.65f;
autoboxData.mDownRatios[i] = 0.50f;
}
std::cout << autoboxData.getLatency() << std::endl; //Outputs 0.5
Thanks again!
EDIT: I apply my autoboxData like this:
driveSimData.setAutoBoxData(autoboxData);
and I can find the correct upRatios and downRatios on my vehicle after initialization