hallo basil_

thanks for your help, but unfortunally it is not my problem

sorry if my english is not enough good and I have let you lost time try to find an alghortim

i know how to calculate the height of the grid in one point

moreover in the my grid structure I mantain also the normal of each vertex so i can obtain easily it and computate the slope pitch and yaw

my problem is another, i will try to explane at the better that i can

my grid is based on triangles

i would like to place vehicles like a car and move it on the grid, the car is something that can be considered schematically as a box

a car has 4 wheels, I know exactly the coordinate of this 4 point (i can computate normal, heigth.. etcc in this point becouse i have all the info)

and this are the 4 points that can enter in contact with the grid

so I would like to find a way to calculate the rotation that i have to apply to the center of gravity of the car

if we considered the grid based on the x,y axis

i need only to calculate the rotation by the x and y axis becouse they are the rotatio that place the wheels in contact with the grid

becouse the z is used only to positionate the car in the direction of the movement

so my problem is to find a good idea to calculate the x and y angles considering that i have 4 point,

i know also that 4 point of the wheels are not enought, immagine this scenario:

-that the car is moving on a little hill (a sort of spike)

-the 4 wheels are located in a point lower down that the the peak of the hill

so the result is that when i will render the car, the wheels are correctly on the grid but may be part of the terrain (the grid)

will be draw inside the car

so if someone can suggest a better algorhitm,

for example another idea could be to conside the 5 points, adding the center of gravity of the car traslated at the level of the wheels as another point that has to be evaluated to computate the x and y angles rotations

or I can consider the 4 point of the wheel of the car, as two triangles (wheel ABC and wheel BCD), and use algorithms for intersections of the triangles to identify the intersections points, and based on the intersections point computate the x and y angles rotations

i never do something like this so i would like to know what is the best approach to achieve this kind of problems