The way I did it is to have an offscreen representation of the track. I use black and white to define can and can't drive areas and then used colours to determine if driver was about to go over a bridge etc. So when pixel check showed green then set car going over and when red back on ground level