car vs. terrain

Hey,
Pretty new to Unity, so I hope I’ll be able to make it clear.
I have a car model that I want to drive on a terrain that I created using the terrain editor. I also have a terrain created by Maya for testing purposes (which has its own mesh collider), but they both react the same, so the problem must be my approach.
The car has to respond to the way the terrain looks, i.e. move up a hill, fall down a hole.
My problem is that if I add a rigidbody to the car, it just falls through the world. If I disable gravity, it just moves through the terrain, despite of the colliders.
If I create a simple cube, the cube interacts with the terrain the way I want the car to interact with it, but the cube is not the car…
Can anyone put me on the right track? Thanks!

I don’t know if you actually said this in your post but this may help if you haven’t done it. Has your car object got a collider? It just wasn’t clear if you met you had colliders on the terrain or the car, you will also need to add wheel colliders to the wheels for realistic gameplay.

Hey Chub,
Thanks for the response. The answer is I think so - I have mesh colliders on both the car and the terrain. I also added colliders to the wheels. Everything works perfect when I place the car on a simple cube, it just won’t interact with the terrain at all.
Should I be looking at character contoller instead?

Hmm that sounds a bit odd, just one more question though is that with the terrain you made in Unity or the one imported from Maya?

They both yield the same result. Strange enough, when I drop a cube on the terrain, it behaves normally (actually hits the terrain, and doesn’t fall through). I guess something is screwed up with my car model, I just can’t figure out what.

I can’t really see what could be wrong it may just be a bug or something.

“There are some limitations when using the Mesh Collider. Usually, two Mesh Colliders cannot collide with each other. All Mesh Colliders can collide with any primitive Collider. If your mesh is marked as Convex, then it can collide with other Mesh Colliders.”

“Convex - If enabled, this Mesh Collider will collide with other Mesh Colliders. Convex Mesh Colliders are limited to 255 triangles.”

as described in here Unity - Manual: Mesh collider component reference

Try other colliders on the car.

Thanks mindreaver. I think I’m getting it. It says my car has more than 255 polygons, and apparently this throws an error when trying to do this. I’ll try working with another object to test it.

For moving objects, use primitive colliders or compound primitive colliders. Mesh colliders are for static objects.

–Eric

Thanks Eric, but I got some of the ideas I was using from the Unity’s car tutorial, where they’re using a mesh collider for the car… :slight_smile:

As far as i know, they use a much simpler mesh in the car tutorial.

the wheel colliders should do the trick with keeping the car above the ground.