Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

share|improve this question
    
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. –  Byte56 Jun 5 '13 at 14:55
    
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. –  Ender Jun 5 '13 at 15:15
    
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. –  Byte56 Jun 5 '13 at 15:19
    
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 –  Ender Jun 5 '13 at 15:38
    
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. –  Byte56 Jun 5 '13 at 15:40
show 3 more comments

1 Answer

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/

share|improve this answer
    
Glad you're on the right track to getting this solved ;) –  Byte56 Jun 10 '13 at 15:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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