Shouldn't be too hard to adjust for terrain height. The surface height at the vehicle's coordinates should already be known. Read in the length of the vehicle and sample the height at the front and back block location of the vehicle and use that to set the height and slope of the vehicle model.
Takes a bit of trig programming no doubt.