heres a method you could use using a simple function i wrote for my game. im not quite sure if it works, but theoretically it should

. i only have multiple matrices going along z, not x.
matricesalongx = 10
matrixsizex = 100
matrixsizez = 100
do
thematrixyoureon = ((round(playerzpos#, matrixsizez#)*matricesalongx) + round(playerxpos#, matrixsizex#)) + 1
playerypos# = get ground height(thematrixyoureon, playerxpos#, playerzpos#) :`i cant remember all the parameters :)
loop
Function round(num#, tonearest#)
ret# = 0
While num# > 0
num# = num# - tonearest#
If num# > 0 Then ret# = ret# + 1
endwhile
EndFunction ret#
this is asuming your first matrix starts at 0,0 and that they are placed like this:
21, 22, 23, 24, 25, 26, 27, 28, 29, 30
11, 12, 13, 14, 15, 16, 17, 18, 19, 20
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (or as many/little as you want along x)
I'm also not sure if get ground height positions are reletive to the matrix you're on, so if they are, you could add this:
playerxposonmatrix# = remainder(playerxpos#, matrixsizex#)
playerzposonmatrix# = remainder(playerzpos#, matrixsizez#)
Function remainder(num#, tonearest#)
ret# = 0
ret# = num#
While num# > 0
num# = num# - tonearest#
If num# > 0 Then ret# = num#
endwhile
EndFunction ret#
sorry for not being able to test it, i dont have DB on atm