b3dTerrainHeight

Queries terrain height at world X/Z position (bilinear interpolation, returns world Y coordinate). Takes entity (terrain entity handle), worldX/worldZ (world space coordinates). Returns height (world Y coordinate at that position, terrain.

3D Graphics

Parameters & Returns

Parameters

entity Int
worldX Double
worldZ Double

Returns

Double

Quick Summary

Queries terrain height at world X/Z position (bilinear interpolation, returns world Y coordinate). Takes entity (terrain entity handle), worldX/worldZ (world space coordinates). Returns height (world Y coordinate at that position, terrain.

Technical Exegesis...

Queries terrain height at world X/Z position (bilinear interpolation, returns world Y coordinate). Takes entity (terrain entity handle), worldX/worldZ (world space coordinates). Returns height (world Y coordinate at that position, terrain.position.Y if out of bounds). Converts world to local terrain space (subtract entity position, divide by scale), samples heightmap with bilinear interpolation (4 nearest samples, smooth between pixels), applies scales (entity.scale.Y * terrain.terrainScale.

Example

Example.bam
; No example implemented yet