Road/Street detection on terrain

Hey guys,

i have a general question concerning how to detect streets on a terrain.

So far, i created a terrain with a splat-texture which creates the road from an image and a little car-model that drives around on the terrain.

the question is:

how can i manage that the car only drives on the road?

is it possible to detect the road from the splat-texture during runtime?

or is this attempt totally wrong?

Thanks in advance.

If you want the car to only drive around on the road, and off-road being limits, one way to think about this is not detecting if the car is on the road, but when it's about to go off road and preventing the car from doing so.

E.g. Use invisible walls at the road edge, and if the car tries to go off road, it gets stopped/bounced back/slides against the wall.

At least that would be one solution, and the collision detection of course can have its varying degrees of difficulty depending on what sort of reaction should happen to the car.

How a bout a collision map, i assume this is a kinda 2d problem, so create a texture that is size of terrain, and black for block, grey for half speed, white for full speed.

Then depending on the wanted detail, you could generate your terrain texture from that map, or have to model it manually

i was doing some research, but i couldnt find out how to create/use a collision map. could you explain that to me?


Some terrain creation tools will let you paint such things on as layers - you can use the same idea for pathing, vegetation and so on. Probably how ever you do your splat maps would work.

I'm also having the same doubts

I created a trimesh being like street and terrain heightmap, would be easiest way?