find y position on mesh

Blitz3D Forums/Blitz3D Programming/find y position on mesh

markcw(Posted 2006) [#1]
how can i find the height (y position) of any given xz point on a terrain mesh, like say for calculating shadows? do you use linepick? what other ways are there? tformpoint?

thanks.


kevin8084(Posted 2006) [#2]
***EDIT...Ignore...I misunderstood your question...

if you position a pivot over the spot that you want the height then linepick straight down, pickedy#() will give you the height at that point x,y. I assume that you are talking about using a mesh as a terrain and not using the blitz3d terrain object.


jfk EO-11110(Posted 2006) [#3]
For terrains (not meshes) there's the terrainY() function. With meshes it may be the easiest way to do a linepick. A pivot is not required, but the mesh must be pickable (EntityPickMode m,2). Do something like:

pick=linepick(x,100,z,0,-200,0,0.1)
if pick=mymesh then
print pickedx()+" "+pickedy()+" "+pickedz()
endif

make sure to use the minimum for y and height, so the pick range is as low as possible.


markcw(Posted 2006) [#4]
thanks to you both. i was confused about how linepick works, but i have it working now. yes i meant for a mesh not a terrain. i had written another way to get the y position but it wasn't reliable as it assumed the mesh vertices were in a particular order.