GE Lua Documentation

Press F to search!

getForward

Definition


-- @/lua/ge/extensions/core/camera.lua:1569

local function getForward()
  local res = vec3(fwdVec)
  res:setRotate(finalCameraData.rot)
  return res
end

Callers

@/lua/ge/extensions/editor/createObjectTool.lua
    else
      local pos = core_camera.getPosition() + vec3(core_camera.getForward():normalized())
      debugDrawer:drawTextAdvanced(pos, "CLICK ANYWHERE TO CREATE AT CAMERA", ColorF(1, 1, 1, 1), true, false, ColorI(100, 100, 155, 255), false, false)
@/lua/ge/extensions/tech/sensors.lua
    local matrix = Research.SensorMatrixManager.getSensorMatrix(sensorId)
    conf.dir = matrix:getForward()
    conf.up = matrix:getUp()
@/lua/ge/extensions/editor/trafficManager.lua
      if anchorPos:squaredDistance(mousePos) <= 0.1 then
        mousePos:setAdd2(anchorPos, core_camera.getForward())
      end

  local pos = core_camera.getPosition() - core_camera.getForward():z0()
  local z = be:getSurfaceHeightBelow(pos) -- snap to ground below camera view
    -- now spawns in the camera direction - consider if OK
    return pos, core_camera.getForward(), false
  end
  -- if the position is out of the road segment, then return the position and adjacent road direction as is for spawning
  -- consider change the spawn direction here to camera's : core_camera.getForward() or make it relevant to the driving direction of the roadside
  if pos:squaredDistance(spawnPos) >= radius * radius then
          -- if no road found, then use the camera direction - update spawnOptions.rot
          spawnOptions.rot = quatFromDir(core_camera.getForward(), vecUp)
        end
          -- no road found, use the camera direction
          spawnOptions.dir = core_camera.getForward()
        end
@/lua/ge/extensions/editor/gen/test.lua

	local direction = vec3(core_camera.getForward())
	local startPoint = vec3(core_camera.getPosition())
@/lua/ge/extensions/editor/gen/world.lua
	cscreen = {im.GetMousePos().x, im.GetMousePos().y}
	local camDir = ray.dir:normalized() -- core_camera.getForward():normalized()
	--            lo('?? Z_DRAG:'..tostring(cmesh))
	--                lo('?? mark:'..tostring(im.GetMousePos())..':'..tostring(rayCast.normal)..':'..tostring(core_camera.getForward()))
	--        if true then return end
	--                lo('?? mark2:'..tostring(dirhit)..':'..tostring(rayCast.normal))
	--        local vx = core_camera.getForward():cross(vec3(0,0,1))
	--        local vy = vx:cross(core_camera.getForward())
	--        local vx = core_camera.getForward():cross(vec3(0,0,1))
	--        local vy = vx:cross(core_camera.getForward())
			if ccenter == nil then return end
		local newdir = U.vturn(dir, -dx/1000)
--        lo('?? around:'..dx..':'..tostring(core_camera.getForward())..':'..tostring(newdir:normalized())) --..':'..tostring(im.GetMousePos().x))
		local newpos = ccenter - newdir
		core_camera.setPosition(0, newpos)
		local fwd = core_camera.getForward()
		local thresh = 500
			cedit.cval['CamRot'] = {
				camdir = core_camera.getForward(),
				center = center,
	if false then
		local direction = vec3(core_camera.getForward())
		local startPoint = vec3(core_camera.getPosition())
@/lua/ge/client/postFx/dof.lua
  -- Fallback to center raycast if vehicle is not in view
  local direction = vec3(core_camera.getForward())
  local farDist = tonumber(TorqueScriptLua.getVar("$Param::FarDist"))
@/lua/ge/extensions/editor/aiViz.lua
          while edgeProgress <= edgeLength do
            color = core_camera.getForward():dot(edgeDirVec) >= 0 and arrowBaseColor or arrowAltColor
            debugDrawer:drawSquarePrism((inNodePos + edgeProgress * edgeDirVec), (inNodePos + (edgeProgress + 2) * edgeDirVec), arrowSize1, arrowSize2, color)
@/lua/ge/extensions/gameplay/traffic.lua
    pos = pos or core_camera.getPosition()
    dir = dir or core_camera.getForward()
    minDist = minDist or 100
@/lua/ge/extensions/editor/trafficSignalsEditor.lua

    local dir1 = selectedObj:getTransform():getForward()
    for _, obj in ipairs(getObjectsByClass("TSStatic") or {}) do
          -- strong assumption that the TSStatics were created with the same initial rotation
          local dir2 = obj:getTransform():getForward()
          if dir1:dot(dir2) >= 0.93 then -- roughly within 20 degrees
@/lua/ge/extensions/core/cameraModes/bigMap.lua
    self.initialCamData = data.initialCamData
    local camLookAtPoint = getRayCastHit({pos = self.initialCamData.pos or core_camera.getPosition(), dir = self.initialCamData.rot and self.initialCamData.rot * vec3(0,1,0) or core_camera.getForward()})
    camToLookAtPoint = camLookAtPoint - self.initialCamData.pos or core_camera.getPosition()
  else
    local camLookAtPoint = getRayCastHit({pos = core_camera.getPosition(), dir = core_camera.getForward()})
    camToLookAtPoint = camLookAtPoint - core_camera.getPosition()
    -- Move the camera to keep the mouse cursor roughly on the same spot
    local camLookAtPoint = getRayCastHit({pos = core_camera.getPosition(), dir = core_camera.getForward()})
    local zoomCamStartPos = vec3(self.bigMapCamPosition)
@/lua/ge/extensions/editor/gen/exp_solidflex.lua
            -- dist to focus
            local dir = core_camera.getForward()
            local dh = U.proj2D(focus-campos):length()/U.proj2D(dir):length()*dir.z
--    lo('?? '..tostring(tocur))
--    core_camera.getForward()
    if cvover and im.IsMouseDragging(0) then
--[[
                local cdir = core_camera.getForward()
                    lo('?? cam_DIR:'..tostring(cdir))
@/lua/ge/extensions/editor/gen/utils.lua
	local campos = core_camera.getPosition()
	local dir = core_camera.getForward():normalized()
	local vx = dir:cross(vec3(0,0,1)):normalized()
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
            end
            local dir = val>0 and core_camera.getForward():cross(vec3(0,0,1)):normalized() or vec3(0,0,1)
            M.space(am, cval[key].am, dir, val, 1, daedata)
            local campos = core_camera.getPosition()
            local dir = core_camera.getForward():normalized()
            local vx = dir:cross(vec3(0,0,1)):normalized()
            local campos = core_camera.getPosition()
            local dir = core_camera.getForward():normalized()
            local vx = dir:cross(vec3(0,0,1)):normalized()
            camTarget.cpos = core_camera.getPosition()
            camTarget.crot = quatFromDir(core_camera.getForward()) --core_camera.getQuat()
--                lo('??++++++++++++ to_DIR:'..tostring(camTarget.dir)..':'..tostring(camTarget.crot)..':'..tostring(quatFromDir(core_camera.getForward())))
            camTarget.crot = quatFromDir(core_camera.getForward()) --core_camera.getQuat()
--                lo('??++++++++++++ to_DIR:'..tostring(camTarget.dir)..':'..tostring(camTarget.crot)..':'..tostring(quatFromDir(core_camera.getForward())))
--            local eu = core_camera.getQuat():toEulerYXZ()
@/lua/ge/server/commands.lua
  local pos = core_camera.getPosition()
  local camDir = core_camera.getForward()
  camDir.z = 0
  local pos = core_camera.getPosition()
  local camDir = core_camera.getForward()
  camDir.z = 0
function getCameraRight() deprecationWarning("getCameraRight", "core_camera.getRight")  return core_camera.getRight() end
function getCameraForward() deprecationWarning("getCameraForward", "core_camera.getForward") return core_camera.getForward() end
function getCameraQuat() deprecationWarning("getCameraQuat", "core_camera.getQuat") return core_camera.getQuat() end
@/lua/ge/extensions/core/trafficSignals.lua
    else
      o.dir:set(core_camera.getForward())
    end
@/lua/ge/extensions/core/multiSpawn.lua
      pos = core_camera.getPosition()
      rot = core_camera.getForward()
      start = 0
@/lua/ge/extensions/editor/slotTrafficEditor.lua
            while edgeProgress <= edgeLength do
              color = core_camera.getForward():dot(edgeDirVec) >= 0 and arrowBaseColor or arrowAltColor
              debugDrawer:drawSquarePrism((inNodePos + edgeProgress * edgeDirVec),
@/lua/ge/extensions/gameplay/traffic/trafficUtils.lua
  startPos = startPos or core_camera.getPosition()
  startDir = startDir or core_camera.getForward()
  minDist = minDist or 20 -- minimum distance from start position
  options.pos = pos or core_camera.getPosition()
  options.dir = dir or core_camera.getForward()
  options.mode = options.mode or 'roadAhead'