Changing behavior depending of the terrain

Hi!

I have a question, and I think that this forum is the best place to ask. Well… I just finish the tutorials of Unity and I’m trying to develop a car racing game. The main features of it I got it.

But I wonder how to manage a couple of things. I hope that you will be able to give some ideas.

Everybody knows that when a car is in the right track (inside the track) the car can get more speed and have a good behavior. But… when the car is on the grass the car decrease his speed and it’s a bit difficult to turn right or left. How can I manage that in the game? I should you a box collider for the grass and manage the behavior of the car from there? Is there another way to manage this situation?

Another question that I have how can I know if the car is going in the right direction or in the wrong? I should use checkpoints for that? Or should I use the minimum distance between checkpoints and calculate this distance in each update?

Thank you very much for your help.

I did something similar to this using terrain mesh objects and tags. I divided my terrain into one mesh I tagged “hard” and another I tagged “soft” and then when an object collides with a “hard” object it behaves one way and when it collides with a “soft” object it behaves differently.

I don’t know of a way to do this with the Unity terrain system but maybe someone else may have found a way…

It works when you use different meshes for the grass and the road, you must only
use different physic materials.

Does it mean that I should have for example my scenery called grass, and I need to insert the track on the that scenery? Is it that what you mean?

Thanks for your answer.

No…

62442--2285--$physicmaterials_190.png
62442--2286--$twomeshes_129.png

No…

62442--2285--$physicmaterials_190.png
62442--2286--$twomeshes_129.png

Mmmmm… ok. I think that I understood you. I will try it!

Thanks!