PhysX 3.3 Vehicle SDK - physX debug renderer shows 2 rigidbody's on my vehicle

I’ve been trying to implement physX vehicles and I have finally something visible on screen, after my excitement cooled down I noticed that my vehicle appears to have 2 rigidbody’s on my vehicle. I don’t know in which way this would affect driving.

So my question is, is this normal? If this is a common error I’d be glad to hear the solution, but I do not expect one. I just want to know if this is supposed to happen.

here’s a gif of what I mean:

and here’s a screenshot from the physX visual debugger:
thank you for your time!

copied from as it was the wrong forum

This is not supposed to happen.

It looks like you have two separate vehicles but only one is being updated. This is good news because the vehicle that does move is likely to be configured correctly with a single rigid body.

PVD seems to be consistent with the gif so it really is the case that you have two vehicles but only one of them moves. I would guess there is some code in your game that is adding a second vehicle. A quick way to debug this is to search for game code that calls PxScene::addActor and see how many times this is called in your game. I would expect it to be called once per vehicle and then once more for the static actor. My guess is that you are creating two vehicles, adding their rigid bodies to the scene, but only passing one of them to PxVehicleUpdates.



Thank you for your answer! I’ll get on it asap :)

Here I add my vehicle actor to my scene

auto vehActor = createVehicleActor(data, wheelMats, wheelConvexMeshes , 4, chassisMats, chassisConvexMeshes, 1, *physX);

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;

		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:


and I can find the correct upRatios and downRatios on my vehicle after initialization


This definitely does not add the actor to the scene: physics.createRigidDynamic. PhysX will never add an actor to the scene because we leave this to the user in order to give them complete freedom. Something in your game code is adding two actors. Perhaps you are calling physXScene->addActor(*vehActor)twice.

I think the problem with the autobox is that you overwrite the latency with the down ratio of reverse gear. If you call setLatency last this will fix your problem.



God I feel stupid, the initialize of my vehicle creation was somehow called twice, which was why I never really found that second call.

Calling setLatency after setting mDownRatios fixes everything
Thanks for your help, Gordon. You really helped me out on this! :)

Good to hear. Glad to help.