Vehicle not falling from track

Hi all.
We are facing a strange issue. We have a loop in which vehicles don’t fall when they are downward in a loop.
We have been breaking our heads once and again with this, and achieved nothing. You can download a physx debugger file where the problem can be observed. It’s on the right of the start point, between rocks. You can see a vehicle stopping in a loop but not falling.

I hope someone can help.

Regards.

Hi,

I’m afraid the firewall here is blocking access to the download. I sent you a pm with details of how to upload it to a temporary ftp account.

Thanks,

Gordon

Hi,
I’ve uploaded the file.

Regards.

Thanks. I’ve downloaded the file.

Is the problem that you expect the car in the loop-the-loop to fall down? It’s not immediately clear that this is guaranteed to happen because it depends on the relative values of car velocity and radius of curvature of the loop. To add to the complexity the car is colliding with the side wall of the loop. It’s hard to know what should theoretically happen here because I don’t have a good sense of scale or speed from pvd.

Can I suggest a simple experiment to really illustrate the problem? Drive the car up the loop and apply the brakes so that the car stops at the highest point of the loop with the car upside down. Please make sure that the car doesn’t collide with the wall of the loop at any point. With no forward velocity the car should quickly fall downwards due to gravitational acceleration. If the car remains stuck to the loop-the-loop then there is definitely a problem that needs further investigation.

Are you using physx vehicles here or is this a custom vehicle?

Thanks,

Gordon

Hi.
The expected behaviour is the car falling, yes. It happens when it doesn’t collide. Actually, if you collide with enough force, somehow it breaks the spell and falls down. It’s quite hard to get the car totally stopped in the loop because of the gravity pulling it downward, hence sliding, but I’ve uploaded a picture of other try I did and a new pvd. The collision points can be seen in the debugger, and none is happening.

Thanks,

By the way, we are using PxVehicleDrive4W, extracted from the vehicle example.

Thanks for the update.

Can you try instead to set the car’s velocity to zero when it hits the peak of the loop?

You can fairly easily do this by adding a trigger shape and then setting the rigid body of the vehicle to have zero linear velocity and zero angular velocity.

Thanks,

Gordon

I’ve done it debugging, but the effect is there. Absolutely stopped in almost the highest part of the loop.

File uploaded.

Thanks. I can see in pvd that the vehicle starts to get a downwards velocity from gravity for a few frames just after you set it to rest. After a few more frames it starts to accelerate upwards. This is indeed very strange.

Can you please try one more thing? After you set the velocity to zero can you permanently stop calling PxVehicleUpdates? If the vehicle falls then we know that the problem is in PxVehicleUpdates. If the vehicle remains at the top of the loop then something else must be holding it there.

Thanks,

Gordon

Hi again,

I just ran a quick test to see what happens with a car that is upside down and has its wheels touching a drivable surface. It looks as though the vehicle sdk handles this. I uploaded a pvd to the ftp site to let you see what happens.

Thanks,

Gordon

I think I might know the answer to your problem.

It looks like your loop-the-loop geometry is very thin at the top. I suspect that the vehicle raycast is picking up the normal pointing upwards on the outside of the loop instead of the normal pointing downwards on the inside of the loop. This will leave the car hanging, just as you are seeing.

To prove this you can inspect the normals recorded by the vehicle with the function PxVehicleWheelsDynData::getTireDrivableSurfaceContactNormal. If the normal ever points upwards when the car is at the peak of the loop then we have found the answer to the gravity-defying car. I suspect that the car sometimes picks up the correct normal and sometimes the wrong normal because the car does fall downwards for a few frames in a row before being pushed upwards again.

The solution here is to thicken the geometry so that the inside and outside faces are at least a few centimetres apart. Can you try this out?

Thanks,

Gordon

Hi, I don’t think that’s the problem, as the geometry is about 1 meter thick.
I’ve uploaded a couple of pics of the loop mesh broken to see the thickness.
Anyway I’ll test with that function to double check.

Yep, the normals are always ok, pointing downward in Y axis when we get over 90º in the loop.

Thanks for taking a look.

I’ve extracted the geometry from pvd and I’ve got a repro now. It does seem like there is a bug. I’m working on a fix for this. Hopefully, it won’t take too long.

Thanks. Would the fix be released in the next physx version or could we take a patch?
In any case, thank you very much.

Hi,

We’ll do our best to get it in the next physx release. In the meantime, I’ve sent you a fix by pm for you to test.

Thanks,

Gordon