GE Lua Documentation

Press F to search!

castRay

Definition


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

Callers

@/lua/ge/extensions/gameplay/race/pathnode.lua

  local hitLeft = Engine.castRay((pLeft), (pLeft-up*rayLength), true, false)
  local hitRight = Engine.castRay((pRight), (pRight-up*rayLength), true, false)
  local hitLeft = Engine.castRay((pLeft), (pLeft-up*rayLength), true, false)
  local hitRight = Engine.castRay((pRight), (pRight-up*rayLength), true, false)
@/lua/ge/extensions/flowgraph/nodes/scene/rectMarker.lua
    local pos = (tpos-x*d-y*w)
    local a = vec3(castRay(pos+vec3(0,0,2), pos-vec3(0,0,10)).pt) + vec3(0,0,0.3)
    pos = (tpos+x*d-y*w)
    pos = (tpos+x*d-y*w)
    local b = vec3(castRay(pos+vec3(0,0,2), pos-vec3(0,0,10)).pt)+ vec3(0,0,0.3)
    pos = (tpos+y*w)
    pos = (tpos+y*w)
    local c = vec3(castRay(pos+vec3(0,0,2), pos-vec3(0,0,10)).pt)+ vec3(0,0,0.3)
    local clr = clrIn
        if not hit then
          hit = Engine.castRay((corner+zVec*i), (corner-zVec*i*2), true, false)
          if hit then
@/gameplay/missionTypes/scatterPickup/customNodes/scatterStuffInZonesNode.lua

          local hit = Engine.castRay(blue + vec3(0,0,5), blue + vec3(0,0,-5), true, false)
          if hit then
@/lua/ge/extensions/scenario/busdriver.lua
    end
    local heightCorrection = be:castRay( (pos), (pos-vec3(0,0,13)) )
    if heightCorrection < 1 then
    if heightCorrection < 1 then
      local tHeight = be:castRay( (tpos), (tpos-vec3(0,0,13)) )
      if tHeight *0.8 > heightCorrection then
        pos.z = pos.z-tHeight*0.8
        heightCorrection = be:castRay( (pos), (pos-vec3(0,0,13)) )
      end
  local proj = vec3(0,0,5)
  local heightCorrection = be:castRay( (vec3Destination+proj), (vec3Destination-proj*3) )
  if debugPath then
@/lua/ge/extensions/util/maptiles.lua
      local rayEnd = vec3(tile.x, tile.y, -1000)
      local hit = Engine.castRay(rayStart, rayEnd, true, true)
      if hit then
@/lua/ge/extensions/editor/biomeTool.lua
  end
  local res = Engine.castRay((startPoint + vec3(0,0,1)), endPoint, true, false)
  if not res then
  if not res then
    res = Engine.castRay((startPoint + vec3(0,0,100)), (startPoint - vec3(0,0,1000)), true, false)
  end
@/lua/ge/extensions/editor/forestEditor.lua
  end
  local res = Engine.castRay((startPoint + vec3(0,0,1)), endPoint, true, false)
  if not res then
  if not res then
    res = Engine.castRay((startPoint + vec3(0,0,100)), (startPoint - vec3(0,0,1000)), true, false)
  end
@/lua/ge/extensions/editor/api/gizmo.lua
  end
  local res = Engine.castRay((startPoint + vec3(0,0,1)), endPoint, true, false)
  if not res then
  if not res then
    res = Engine.castRay((startPoint + vec3(0,0,100)), (startPoint - vec3(0,0,1000)), true, false)
  end
@/lua/ge/extensions/editor/rayCastTest.lua
    if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
    local hit = Engine.castRay((vec3(pos) + vec3(0, 0, 4)), (vec3(pos) + vec3(0, 0, -4)), true, false)
    if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/ge_utils.lua
-- returns nil on no hit, otherwise table
function castRay(origin, target, includeTerrain, renderGeometry)
  if includeTerrain == nil then includeTerrain = false end

  local res = Engine.castRay(origin, target, includeTerrain, renderGeometry)
  if not res then return res end

  local res = castRay(origin, target, includeTerrain, renderGeometry)
@/lua/vehicle/ai.lua

local function castRay(rpos, rdir, rayDist)
  for i = 1, twt.OBBinRange.n, 4 do
      helperVec:normalize()
      local rayLen = castRay(tmpVec, helperVec, min(twt.rayMins[i], rayDist))
      if twt.rayMins[i] > rayLen or rayLen == rayDist then
        helperVec:normalize()
        twt.rayMins[i] = castRay(tmpVec, helperVec, min(max(2 * twt.rayMins[i], 0.02), rayDist))
      end
        helperVec:normalize()
        local rayLen = castRay(tmpVec, helperVec, min(twt.rayMins[i], rayDist))
          helperVec:normalize()
          twt.rayMins[i] = castRay(tmpVec, helperVec, min(2 * twt.rayMins[i], rayDist))
        end
@/lua/ge/extensions/scenario/raceMarkers/singleHologramMarker.lua
  if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
  local hit = Engine.castRay(self.pos+up*rayLengthUp, self.pos+up*rayLengthDown, true, false)
  if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/scenario/raceMarkers/sideHologramMarker.lua

  local hitLeft = Engine.castRay(pLeft+up*rayLengthUp, pLeft+up*rayLengthDown, true, false)
  local hitRight = Engine.castRay(pRight+up*rayLengthUp, pRight+up*rayLengthDown, true, false)
  local hitLeft = Engine.castRay(pLeft+up*rayLengthUp, pLeft+up*rayLengthDown, true, false)
  local hitRight = Engine.castRay(pRight+up*rayLengthUp, pRight+up*rayLengthDown, true, false)