VE Lua Documentation

Press F to search!

getSurfaceHeightBelow

Definition


-- @/=[C]:-1
function getSurfaceHeightBelow(...)

Callers

@/lua/ge/extensions/gameplay/traffic.lua
        -- focus dist becomes dependent on height above ground, to keep traffic vehicles active
        local height = max(-1e6, be:getSurfaceHeightBelow(focus.pos))
        focus.dist = clamp(square(focus.pos.z - height) / 15, 20, 200) -- forced minimum distance of 20 m
@/lua/vehicle/controller/tech/roadsSensor.lua
  local frontAxleMidpoint, rearAxleMidpoint = pos + (wp[min(ctr, 3)] + wp[min(ctr, 4)]) * 0.5, pos + (wp[min(ctr, 1)] + wp[min(ctr, 2)]) * 0.5
  local frontAxleMidpointProjGround = vec3(frontAxleMidpoint.x, frontAxleMidpoint.y, obj:getSurfaceHeightBelow(frontAxleMidpoint))
      pInt.z = p1.z +2 --9999
      pInt.z = obj:getSurfaceHeightBelow(pInt)
      pLeftRaw.z, pRightRaw.z = p1.z +2, p1.z +2 --9999, 9999
      local pLeft = vec3(pLeftRaw.x, pLeftRaw.y, obj:getSurfaceHeightBelow(pLeftRaw))
      local pRight = vec3(pRightRaw.x, pRightRaw.y, obj:getSurfaceHeightBelow(pRightRaw))
      local pLeft = vec3(pLeftRaw.x, pLeftRaw.y, obj:getSurfaceHeightBelow(pLeftRaw))
      local pRight = vec3(pRightRaw.x, pRightRaw.y, obj:getSurfaceHeightBelow(pRightRaw))
@/lua/ge/extensions/editor/objectToSplineEditor.lua
        if not hasTerrain or not validSurface then
          pos.z = be:getSurfaceHeightBelow(pos + vecUp)
          dirVecUp:set(map.surfaceNormal(pos, 1))
      local pos = obj:getPosition() + offset * 1.1
      pos.z = be:getSurfaceHeightBelow(pos + vecUp) + 0.1
@/lua/ge/extensions/scenario/raceMarkers/crawlMarker.lua
      else
        local surfaceHeight = be:getSurfaceHeightBelow(leftPos + vec3(0, 0, 1))
        if surfaceHeight then
      else
        local surfaceHeight = be:getSurfaceHeightBelow(rightPos + vec3(0, 0, 1))
        if surfaceHeight then
  else
    local surfaceHeight = be:getSurfaceHeightBelow(self.pos + vec3(0, 0, 1))
    if surfaceHeight then
@/lua/ge/extensions/core/trafficSignals.lua
    o.pos:set(core_camera.getPosition())
    o.pos.z = be:getSurfaceHeightBelow(o.pos)
  end
@/lua/vehicle/mapmgr.lua

  p1.z = obj:getSurfaceHeightBelow(p1)
  p2.z = obj:getSurfaceHeightBelow(p2)
  p1.z = obj:getSurfaceHeightBelow(p1)
  p2.z = obj:getSurfaceHeightBelow(p2)
  p3.z = obj:getSurfaceHeightBelow(p3)
  p2.z = obj:getSurfaceHeightBelow(p2)
  p3.z = obj:getSurfaceHeightBelow(p3)
@/lua/ge/extensions/editor/trafficManager.lua
  local pos = core_camera.getPosition() - core_camera.getForward():z0()
  local z = be:getSurfaceHeightBelow(pos) -- snap to ground below camera view
  if z > 1e-6 then
        spawnOptions.pos = core_camera.getPosition()
        local z = be:getSurfaceHeightBelow(spawnOptions.pos) -- snap to ground below camera view
        if z > 1e-6 then
          sessionData.aiData.targetPos = core_camera.getPosition()
          local z = be:getSurfaceHeightBelow(sessionData.aiData.targetPos) -- snap to ground below camera view
          if z > 1e-6 then
        spawnOptions.pos = core_camera.getPosition()
        local z = be:getSurfaceHeightBelow(spawnOptions.pos) -- snap to ground below camera view
        if z > 1e-6 then
@/lua/ge/extensions/flowgraph/nodes/scene/camera/cameraCircle.lua
  if self.pinIn.snapHeight.value then
    local nextZ = be:getSurfaceHeightBelow(self.camPos) + height
    if nextZ < self.centerPos.z + math.min(-1, height - 1) then -- if surface height is too low
@/lua/ge/extensions/flowgraph/nodes/vehicle/groundDistance.lua
    offset.z = offset.z + (self.pinIn.zOffset.value or 10)
    local hit = be:getSurfaceHeightBelow(offset)
    if hit then
@/lua/ge/extensions/core/multiSpawn.lua

  local z = be:getSurfaceHeightBelow((pos + vecUp * 4))
@/lua/ge/map.lua

  p1.z = be:getSurfaceHeightBelow(p1)
  p2.z = be:getSurfaceHeightBelow(p2)
  p1.z = be:getSurfaceHeightBelow(p1)
  p2.z = be:getSurfaceHeightBelow(p2)
  p3.z = be:getSurfaceHeightBelow(p3)
  p2.z = be:getSurfaceHeightBelow(p2)
  p3.z = be:getSurfaceHeightBelow(p3)
    local laneColor2 = ColorF(0.2, 0.4, 1, 1)
    local drawDist = clamp(camPos.z - be:getSurfaceHeightBelow(camPos), 20, 300)
@/lua/ge/extensions/gameplay/parking.lua
    if commands.isFreeCamera() then
      local height = max(-1e6, be:getSurfaceHeightBelow(focus.pos))
      height = focus.pos.z - height
@/lua/ge/extensions/core/hotlapping.lua
      cpPos = vec3(be:getObjectOOBBCenterXYZ(vehId))
      cpPos.z = be:getSurfaceHeightBelow(cpPos)
    else
@/lua/common/tech/techUtils.lua
  local topPos = vec3(pos.x, pos.y, pos.z + 2)
  local height = get:getSurfaceHeightBelow(topPos)
  if height > -1e10 then -- the function returns -1e20 when the raycast fails
  topPos.z = 1e5
  height = get:getSurfaceHeightBelow(topPos)
  if height > -1e10 then
@/lua/ge/extensions/gameplay/crawl/boundary.lua
      else
        pos.z = be:getSurfaceHeightBelow(pos + vec3(0, 0, 1)) + 0.1
      end
@/lua/vehicle/ai.lua
  ego.pos:set(obj:getFrontPosition())
  ego.pos.z = max(ego.pos.z - 1, obj:getSurfaceHeightBelow(ego.pos))
  ego.prevDirVec:set(ego.dirVec)