placing objects on a heightmap

Hiow can i place my objects so its on the actual heightmap? i have bneen trying to use the zx and z coordinates of my object to reference a 2d array which stores the height map values, but it just doesnt work.

Can anyone help me please??

What should i be looking to do

What you’re doing should work. Of course you may have to add interpolation between values if you want to sit on triangles between samples and your interpolation will need to accounte for the triangulation of the terrain subdivision.

You should be able to see it working at least approximately when grabbing simple samples. Get that working approximately then advance to teh interpolation between height samples.