Kinematic movement with car

I want to use kinematic type and not dynamic but the model of city has elevation and bumps and movement looks like this

So what is the way to do it with kinematic so the car will not hides below the track?
We try to use dynamic but there is some weird issues and the movement is not as we expected

You could raycast to the ground and move the car to to be X units above the ground. Otherwise kinematic means it will just go through other rigidbodies.

Or you can try an alternative method of dynamic cars like these developers:


Thanks for the fix @yaustar. I’m confident the ray-casting will work, will revert after we try it.

You might want to do multiple raycasts (one for each wheel) so you can also rotate the car the to match the terrain.

1 Like

So we must use raycast combined with collision detection?
and to clarify the car isnt go down to the road but it drives straight
but the elevation of model of city acts like this so it seems the car drives under the road

@yaustar, we figured out a way to get the distance b/w the car and the road, and stop it from going through the road. However, is there any way we can do the same for the walls? I’m not a big fan of using the sphere collision shape for cars, as I am looking to make the game more realistic.

TBH, I don’t think going kinematic only will give you the best results as it won’t react to collisions the way you really expect (since it just goes through everything).

I would definitely go dynamic, either with a technique similar to the ball variant above (which represents movement, not collision of the car) or going full vehicle simulation (as shown in this project:

1 Like

Maybe the full vehicle simulation would work better. Its just that the mesh colliders we’re using has a lot of tris, and going with dynamic causes the car to bounce like crazy.

This is partially the reason why I strongly suggested that the team simplifies the collision mesh to be as low poly as possible. Going full vehicle simulation is unlikely to make it much better.

I’m aware of that.

The thing is, we’re trying to simulate a real life location in our game, and wouldn’t like to compromise on how realistic it looks, due to it having a strong connection with racing. We could probably look to reduce the quality of the buildings, and other stuff around the road, but I’d really prefer not to touch the road.

The model mesh and the collision can be different. The model (visible mesh) can be as high quality as you can get it but the collision mesh should be as simple as possible. Pretty much every game does this.

The road collision doesn’t need to be more complicated than this: