heightAt method

double? heightAt(
  1. double x,
  2. double z, {
  3. int level = 0,
  4. bool checkObstacle = true,
})

Walkable height (model Y) at (x, z) on level, or null if the point is off the walkable surface (or blocked when checkObstacle).

Implementation

double? heightAt(double x, double z, {int level = 0, bool checkObstacle = true}) {
  if (checkObstacle && isObstacle(x, z)) return null;
  final cells = _levelCells[level] ?? _levelCells[0];
  if (cells == null) return null;
  final c = _cellIndex(x, z);
  if (c < 0) return null;
  for (final t in cells[c]) {
    if (_inTri(t, x, z)) return _planeY(t, x, z);
  }
  return null;
}