place or move solid on grids (heighmap)

hallo guys

i have a highmap grid used to create a terrain
now i would like to move same solid over it, i mean following the irregularities of the terrain
before to start the implementation i would like to see what are the possible implementations

my understanding is that the relation in terms of size between the solid (the car) and the size of the tile in the grid is very important
to have a more realistic effect is better that the tiles of the grid are more little that the size of the solid

to get the height of the map in a point i can add to terrain object a function
int height = terrain.getHeigth(Vector point)
this function try to find the height of the closest vertex on the grid

my idea was to get the point of the 4 wheel of the car, identify the height of each single point
and find a way to calulate the 2 angles rotation by z and x (if the grid is on x z plan)

now this is the real question!, the algorithm to calculate the rotation agles

still I don’t know what is the algotihym that i have to apply to generate the two angles
my idea was to computate angles in this way:
angel rotation by z) angle between the front wheels and angle back wheels and get the max or the average
angel rotation by x) angle between the left wheels and angle right wheels and get the max or the average

i can also verify if the angle is not over a limit and accept the movement, to avoid to have car that are able to go over the walls

i see different problem in this implementation, I mean in the result
immagine that i’m calculating the z angle and the terrain for the point of view of the front wheel as a slope in the opposit direction of the back wheel
same problme appear calculating the x angle if the slope of the right side is opposit of the left side

so i suppose that i’m using a worng alghoritm to computate the two rotation angles or may be i can not calculate the correct position with only 4 point but i nedd a 5th point that is the center of the solid