Does anyone know the correct algorithm to use when calculating height based on a terrain heightmap? At the moment I have it referencing the nearest height value to the current viewpoint. This is very jerky however, especially when moving over hills! I’m trying to interpolate the height over each tile using the following:
HeightCurrent = terrain(current_x, current_z)
HeightNext = terrain(current_x, current_z+1)
PositionOnTile = current_z - (int)(current_z)
Height = (HeightNext-HeightCurrent) *PositionOnTile
Am I doing something wrong? Does anyone have a better method?