Why 'Y' parameter?

Blitz3D Forums/Blitz3D Beginners Area/Why 'Y' parameter?

_PJ_(Posted 2004) [#1]
Why does TerrainY need a Y parameter?

surely it would just return the Y value for the terrain at x,z coords???


electronin(Posted 2004) [#2]
I've been wondering the same thing. I just put 0 for the Y parameter whenever I use it ;)


AbbaRue(Posted 2004) [#3]
I believe that is there just for balance in that function.
TerrainX has X and TerrainZ has Z.
Probably all 3 use the same C code only returning a different paramater.


Rob Farley(Posted 2004) [#4]
For want of not repeating, I just stick a 0 in the Y paremeter.


_PJ_(Posted 2004) [#5]
I did have a snippet of code that went something like:

Altitude=(EntityY(Ship,1)-(TerrainY(Terrain,EntityX(ship,1),(EntityY(Ship,1)),EntityZ(Ship,1)))

This was giving some rather odd readings, until I did as suggested, and put a 0 in...


_PJ_(Posted 2016) [#6]
12 years later it dawns on me.

The parameter is the world coordinate.
There's no guarantee that the terrain is necessarily aligned with a given plane.

For example

RotateEntity Terrain,90,0,0
MoveEntity Terrain,0,-200,-10

Therefore the TerrainY value is absolute in global coordinates.