1
\$\begingroup\$

We have been facing a strange issue with physx vehicles. The game behaves correctly in almost every situation: jumps, impacts, etc.

Gravity is applied correctly downward.

But when the vehicle is put upside down in a track, in a loop or twist, somehow it's stuck to the track as if SpiderCar was playing.

Find a video of it here. And an image below:

enter image description here

We are using PxVehicleUpdate::updateDrive4W as coming in the framework version 3.2.2 So the call is just

void VehicleManager::updateVehicle(const PxF32 timestep, 
const PxVec3& gravity,PxVehicleDrivableSurfaceToTireFrictionPairs * mSurfaceTirePairs)
{
    PxVehicleUpdates(timestep,gravity,*mSurfaceTirePairs,mNumVehicles,mVehicles);
}

Gravity is a vector (0.0,-9.8,0) being Y the vertical coordinates. Inside it calls updateDrive4W for all the vehicles, which is about 400 lines

\$\endgroup\$
  • \$\begingroup\$ I'm guessing if you were to flip the car upside-down it would float up into the air? It seems as though you're applying the gravity to the cars local down, instead of the world down. Nice improvements on the question. \$\endgroup\$ – MichaelHouse Jun 5 '13 at 14:55
  • \$\begingroup\$ Actually, when the car is in air or somehow it breaks connection to the track, it works fine. For example, if you collide with the borders or other car with enough force the "spell" breaks and it falls down. So gravity is applied globally. \$\endgroup\$ – Ender Jun 5 '13 at 15:15
  • \$\begingroup\$ You don't have any other forces being applied to the vehicle? Something to keep it on the road in the first place? Can you post a snippet of code showing how you've created the car and how you're updating it. Smallest amount of code possible. \$\endgroup\$ – MichaelHouse Jun 5 '13 at 15:19
  • \$\begingroup\$ No extra forces added, we tried to investigate if physx applies itself a force that, consistently with forces in real world, would apply a force towards the track incremented exponentially by the velocity. But we found nothing \$\endgroup\$ – Ender Jun 5 '13 at 15:38
  • \$\begingroup\$ Actually, I'm betting that PxVehicleDrivableSurfaceToTireFrictionPairs is adding forces to keep the car on the road. You may want to look into the documentation for that. \$\endgroup\$ – MichaelHouse Jun 5 '13 at 15:40
2
\$\begingroup\$

The answer is quite easy: it's a bug, confirmed by physx team. https://devtalk.nvidia.com/default/topic/546019/vehicle-not-falling-from-track/

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Glad you're on the right track to getting this solved ;) \$\endgroup\$ – MichaelHouse Jun 10 '13 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.