# Rigidbody hits invisible bumps on slopes

Drving a rigidbody car over slopes its hitting invisible bumps. I’m pretty sure its got something
to do with the physics because the invisible bumps and not in the same place and the slopes are
not really that steep, I’m using a mesh collider. 30 years ago games like Ridge Racer and Daytona
had smooth driving over slopes surely Unity today should be able to easily do this if not how did they do it back then?

Instead of sliding the car over the road using AddForce and having it bump into the air every time it hits a crack in the road you can use wheel colliders to make the car smoothly roll over the cracks.

I’ve got a wheel collider version but I don’t like it, I can’t get it to go near as fast as I want and it also has some stability problems. This version is sliding with sphere colliders and my only problem with it is hitting invisible bumps on slopes its perfect on a flat plane. The bumps are always in different places every time I test so I don’t really know what is happening.

How are you moving the car that has wheel colliders?. I have to ask because I’ve seen some people attempt to push their car with wheels using AddForce which isn’t the correct method. Instead we’re supposed to drive the wheels by setting their motorTorque property. And if we drive all four wheels then it will accelerate or climb hills much faster.

Yes I was setting the motorTorque. It was fine for just driving around but I need a fast racing game and the wheel collider couldn’t handle it. Have you ever seen something like Outrun 2? I need to go fast like that and I can’t get the wheel collider to do it.

Okay, well I think the issue you’re having is known as ghost collisions. When sliding a rigidbody across a surface made from multiple sections the rigidbody will sometimes bump into the air as it passes from one section to the next.

If you don’t want to use a wheel colliders then you could make each track section slightly lower then the previous section to avoid the bumping issue. Or you could make the whole track surface from a single mesh so then there’s no cracks, but this might put a strain on the physics engine.

Another solution is to add a physics material with zero friction and take care of the friction yourself. If using this method then be sure to set the physics material’s ‘Dynamic Friction’ to zero and the ‘Friction Combine’ property to ‘Minimum’.

I’ve tried slightly lowering each section but then you can’t drive the opposite way. I havn’t tried making the whole track a single mesh, I would have to something like that in Blender wouldn’t I?

Yep, if lowering track sections then you can only go one way. And yep again - use Blender or similar to make the track from a single mesh.

But try the zero friction method first to see if you can get along with it.

Unfortunately I don’t think you’re gonna get the kind of high speed Outrun 2 / Ridge Racer / Burnout Takedown / SSX Tricky, etc. type of motion without your own custom physics “ribbon follower” tech.

My limited experimentation with trying to get this effect a few years back leads me to this conclusion.

I think you basically need to have it fly down a spline-based track taking its height parametrically and doing all your own tracking of where the car should be.

I’d love to hear from someone who made one of these “go speed racer” kinda games in Unity…

I think you are right Unity can not handle those type of games, too fast and too smooth but they did it 30 years ago.

Thanks I do have zero friction on everything, I’ll try Blender I’ve never used it before.

I think it is more accurate to say that generic rigidbody physics (such as Unity implements) can’t handle it.

It’s just custom physics tailored to getting that eyeball bleed speed effect, that’s all… a lot of those games didn’t have real physics: if you did bump something or crest a sharp hill and leave the ground it was almost always some kind of timed sequence of offsetting you a bit and bringing you back down. And if you hit something hard enough that it would look weird, they would just kill you or stop you.

You may find it easier to create a terrain and then use Unity’s spline tool to create a road on top of the terrain. I’ve never tried the spline tool myself and so I’m not sure how well it can generate a road mesh.

I have actually tried that as well. I’ve tried spine tool, spline tool on terrain, just terrain by itself. Ultimately they all had the same problem of either ghost collisions or simply not be able to get the surface smooth enough unless it was 100% flat. The problem is always what you mentioned earlier about sliding the rb and how it always can find a crack or bump. I’m going to keep working at it though.