GE Lua Documentation

Press F to search!

cameraMouseRayCast

Definition


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

Callers

@/lua/ge/extensions/editor/util/editorElementHelper.lua
  self.mouseInfo.rayDir = vec3(self.mouseInfo.ray.dir)
  self.mouseInfo.rayCast = cameraMouseRayCast()
  self.mouseInfo.valid = self.mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/sitesEditor.lua
  mouseInfo.rayDir = vec3(mouseInfo.ray.dir)
  mouseInfo.rayCast = cameraMouseRayCast()
  mouseInfo.valid = mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/trafficManager.lua
  if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
  local rayCast = cameraMouseRayCast()
  if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
        if tempEditMode == "objectSelect" then
          local rayCastInfo = cameraMouseRayCast(true, bit.bor(SOTStaticShape, SOTStaticObject))
          if rayCastInfo and im.IsMouseClicked(0) and editor.isViewportHovered() and not editor.isAxisGizmoHovered() then
@/lua/ge/extensions/editor/objectTool.lua
    end
    rayCastInfo = cameraMouseRayCast(true, defaultFlags)
  end

      local rayCastInfo = cameraMouseRayCast(true, defaultFlags)
      if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
        end
        local rayCastInfo = cameraMouseRayCast(true, defaultFlags)
        if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
    end
    local rayCastInfo = cameraMouseRayCast(true, defaultFlags)
    if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/editor/biomeTool.lua
    if imgui.GetIO().WantCaptureMouse == false then
      hit = cameraMouseRayCast(false, imgui.flags(SOTTerrain))
    end
  if imgui.GetIO().WantCaptureMouse == false then
    hit = cameraMouseRayCast(false, imgui.flags(SOTTerrain))
  end
@/lua/ge/extensions/editor/slotTrafficEditor.lua
  if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
  local rayCast = cameraMouseRayCast()
  if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/util/groundModelDebug.lua
  if mouseFocus[0] then
    local res = cameraMouseRayCast()
    if res and res.pos then
@/lua/ge/extensions/editor/assetBrowser.lua
  if var.dragDropMesh then var.dragDropMesh:disableCollision() end
  local hit = cameraMouseRayCast(false, rayCastFlags)
  if var.dragDropMesh then var.dragDropMesh:enableCollision() end
@/lua/ge/extensions/gameplay/rally/driveline/drivelineRoute.lua
  if val then
    local mouseRayCast = cameraMouseRayCast()
    local newPos = mouseRayCast.pos
  if self.trackMouseLikeVehicleEnableMovement then
    local mouseRayCast = cameraMouseRayCast()
    local newPos = mouseRayCast.pos
@/lua/ge/extensions/editor/gen/utils.lua
	if not b then
		local rayCast = cameraMouseRayCast(false)
		if rayCast then b = rayCast.pos end

	local rayCast = cameraMouseRayCast(false)
	if not rayCast then return end
	if not b then
		local rayCast = cameraMouseRayCast(false)
		if rayCast then b = rayCast.pos end
@/lua/ge/extensions/editor/gen/region.lua
	W = oworld
	local p = cpoint -- cameraMouseRayCast().pos
--        U.dump(adec[133], '?? pop_adec:'..tableSize(adec)..':'..tostring(p))
--    if true then return end
	local rayCast = cameraMouseRayCast(false)
	if im.IsMouseClicked(0) and rayCast then
@/lua/ge/extensions/editor/rayCastTest.lua
  local camMouseRay = getCameraMouseRay()
  local rayCastInfo = cameraMouseRayCast(true, -1)
@/lua/ge/extensions/editor/materialEditor.lua
          end
          local rayCastInfo = cameraMouseRayCast(true, defaultFlags)
          if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/editor/dragRaceEditor/utils.lua
  mouseInfo.rayDir = vec3(mouseInfo.ray.dir)
  mouseInfo.rayCast = cameraMouseRayCast()
  mouseInfo.valid = mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/vizHelper.lua

  local mouseHit = cameraMouseRayCast()
  if not mouseHit or not mouseHit.pos then
@/lua/ge/extensions/editor/gen/exp_frame.lua
    local inview = U.inView()
    local rayCast = cameraMouseRayCast(false)
@/lua/ge/extensions/editor/gen/terrain.lua
--------------------
    local rayCast = cameraMouseRayCast(false)
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
  self.mouseInfo.rayDir = vec3(self.mouseInfo.ray.dir)
  self.mouseInfo.rayCast = cameraMouseRayCast()
  self.mouseInfo.valid = self.mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/driftDataEditor.lua
  mouseInfo.rayDir = vec3(mouseInfo.ray.dir)
  mouseInfo.rayCast = cameraMouseRayCast()
  mouseInfo.valid = mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veCrashTester.lua
    -- Choosing start position
    hit = cameraMouseRayCast(false, im.flags(SOTTerrain))
    if hit then
@/lua/ge/extensions/editor/forestEditor.lua
    if im.GetIO().WantCaptureMouse == false then
      hit = cameraMouseRayCast(false, im.flags(SOTTerrain))
    end
          forest:disableCollision()
          local hit = cameraMouseRayCast(false, nil, rayRange)
          forest:enableCollision()
        if im.GetIO().WantCaptureMouse == false then
          hit = cameraMouseRayCast(false, im.flags(SOTTerrain))
        end
      if im.GetIO().WantCaptureMouse == false then
        local hit = cameraMouseRayCast(false, nil, rayRange)
        if not hit then return end
@/lua/ge/extensions/editor/gen/exp_solidflex.lua
    local inview = U.inView()
    local rayCast = cameraMouseRayCast(false)
    if rayCast then
@/lua/ge/extensions/editor/raceEditor.lua
  mouseInfo.rayDir = vec3(mouseInfo.ray.dir)
  mouseInfo.rayCast = cameraMouseRayCast()
  mouseInfo.valid = mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/gen/network.lua
    if im.IsMouseClicked(0) then
        local rayCast = cameraMouseRayCast(true)
        if not rayCast then return end
        local nm = rayCast.object.name
    --            print('?? MC:'..cameraMouseRayCast(true).object.name)
        if not im.IsWindowHovered(im.HoveredFlags_AnyWindow) and not im.IsAnyItemHovered() then
@/lua/ge/extensions/editor/gen/mesh.lua
	if not pfr then
		local rayCast = cameraMouseRayCast(true)
		pfr = core_camera.getPosition()
	local sto = to
	local rayCast = cameraMouseRayCast(true)
	local aimi = {}
	local sto = to
	local rayCast = cameraMouseRayCast(true)
	local amesh = {}
	local sto = to
	local rayCast = cameraMouseRayCast(true)
	local amesh = {}
	local sto = to
	local rayCast = cameraMouseRayCast(true)
	local amesh = {}
@/lua/ge/extensions/editor/missionStartPositionEditor.lua
  local ray = getCameraMouseRay()
  local rayCast = cameraMouseRayCast()
  local mousePos3D = rayCast and vec3(rayCast.pos) or nil
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
  if driving then return end
  local res = cameraMouseRayCast(true)
  if paintModes.Select.active[0] == true then
@/lua/ge/extensions/editor/crawlEditor/input.lua
  mouseInfo.rayDir = vec3(mouseInfo.ray.dir)
  mouseInfo.rayCast = cameraMouseRayCast()
  mouseInfo.valid = mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/createObjectTool.lua
  if not currentClassInstance then return end
  local rayCastInfo = cameraMouseRayCast(true)
@/lua/ge/extensions/editor/meshEditor.lua
  if selectedMesh then selectedMesh:disableCollision() end
  local rayCastNoMesh = cameraMouseRayCast(false)
  if selectedMesh then selectedMesh:enableCollision() end

    meshRayCastRes = cameraMouseRayCast(false)
    -- Check if water object is a mesh
@/lua/ge/extensions/editor/gen/decal.lua
--    local rayCastHit
    local rayCast,rayCastHit = cameraMouseRayCast(false)
--            lo('?? D.upd:'..tostring(rayCast))
@/lua/ge/extensions/editor/rallyEditor.lua
  mouseInfo.rayDir = vec3(mouseInfo.ray.dir)
  mouseInfo.rayCast = cameraMouseRayCast()
  mouseInfo.valid = mouseInfo.rayCast and true or false
@/lua/ge/extensions/editor/terrainEditor.lua
  if im.GetIO().WantCaptureMouse == false then
    hit = cameraMouseRayCast(false, im.flags(SOTTerrain))
    if not brushCenter and hit or brushCenter then
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veVehicleSpawner.lua
    -- Choosing start position
    hit = cameraMouseRayCast(false, im.flags(SOTTerrain))
    if hit then
@/lua/ge/extensions/flowgraph/nodes/debug/cameraMouseRayCast.lua
function C:work()
    local hit = cameraMouseRayCast()
    if hit then
@/lua/ge/extensions/editor/aiViz.lua
  if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
  local rayCast = cameraMouseRayCast()
  if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/editor/trafficSignalsEditor.lua
  if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
  local rayCast = cameraMouseRayCast()
  if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/editor/gen/world.lua
--    if scope == nil then scope = 'building' end
		U.dump(cij, '>>----------- mdown:'..tostring(rayCast.object.name)..'/'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(scope)..':'..tostring(cij ~= nil and cij[1] or nil)..':'..tostring(cedit.mesh)..':'..tostring(rayCast.pos)..':'..tostring(#editor.getAllRoads())) --..':'..tostring(ray.pos)..':'..tostring(ray.dir)) --..':'..tostring(hit))
--    cmesh = nil
				-- select part
				rayCast = cameraMouseRayCast(true)
--                    U.dump(cij, '?? RH4:')
			--lo('?? for_VEDGE2:', true)
		-- local rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--            local rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
		-- local rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--            local rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
		local shift = U.proj2D(rayCast.pos - smouse)
-- MOVE SPLIT LINE along
			rayCast = cameraMouseRayCast(false)
			if not cedit.cval['DragPos'] then
			if not cedit.cval['DragPos'] then
				lo('?? Z-drag:') --..tostring(cameraMouseRayCast(true).object.name), true)
				cedit.cval['DragPos'] = {
				cedit.cval['DragPos'] = {
					mouse = cameraMouseRayCast(true).pos,
					pos = adesc[cedit.mesh].pos,
			end
			local ds = cameraMouseRayCast(true).pos - smouse
				lo('?? Z_dragging:'..tostring(ds)) --..':'..tostring(cameraMouseRayCast(true).object.name), true)
			local ds = cameraMouseRayCast(true).pos - smouse
				lo('?? Z_dragging:'..tostring(ds)) --..':'..tostring(cameraMouseRayCast(true).object.name), true)
			adesc[cedit.mesh].pos = cedit.cval['DragPos'].pos + ds:dot(vec3(0,0,1))*vec3(0,0,1)
--        if not (rayCast.object and string.find(rayCast.object.name, 'GroundPlane')==1) then
--            rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--        end
--						lo('?? mdrag_free:'..key..':'..tostring(smouse)..':'..tostring(s))
						local a,b = smouse,cameraMouseRayCast(false).pos
						local u,v = U.proj2D(b-a),vec3(0,0,(b-a).z)
		end
		local rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
		if scope == 'building' then
			if rayCast then
	--            lo('?? drag_pos:'..cameraMouseRayCast(false, im.flags(SOTTerrain)).object.name..':'..cameraMouseRayCast().object.name..':'..tostring(rayCast.pos)..':'..tostring(smouse)..':'..tostring(adesc[cedit.mesh].pos))
				if not cedit.cval['DragPos'] or not cedit.cval['DragPos'].pos then
			if rayCast then
	--            lo('?? drag_pos:'..cameraMouseRayCast(false, im.flags(SOTTerrain)).object.name..':'..cameraMouseRayCast().object.name..':'..tostring(rayCast.pos)..':'..tostring(smouse)..':'..tostring(adesc[cedit.mesh].pos))
				if not cedit.cval['DragPos'] or not cedit.cval['DragPos'].pos then
			if not cedit.cval['DragPos'] then
				cedit.cval['DragPos'] = {hmouse = cameraMouseRayCast(true).pos} -- rayCast.pos}
				return
			local c1 = cedit.cval['DragPos'].hmouse
			local c2 = cameraMouseRayCast(true).pos --rayCast.pos
			local vz = (c2-c1):dot(vec3(0,0,1))*vec3(0,0,1)
		if not cedit.cval['DragPos'] then
--            lo('?? FOREST:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
		if not cedit.cval['DragPos'] then
--            lo('?? FOREST:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
--            lo('?? FOREST:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
--            smouse = rayCast.pos
			cedit.cval['DragPos'] = {mouse = cameraMouseRayCast(true).pos}
			lo('?? FOREST:'..tostring(cedit.cval['DragPos'].mouse), true) --..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(cedit.cval['DragPos'].mouse-rayCast.pos))
--            smouse = rayCast.pos
]]
		rayCast = cameraMouseRayCast(true)
		local ds = rayCast.pos - smouse
-- MOVE FLOOR
--                rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
--                lo('?? move floor:'..tostring(camDir)..':'..dx..':'..dy..':'..tostring(ds)..':'..tostring(rayCast.pos))
	end
--	rayCast = cameraMouseRayCast(true)  -- true to detect forest
--    rayCast = cameraMouseRayCast(false)
--	rayCast = cameraMouseRayCast(true)  -- true to detect forest
--    rayCast = cameraMouseRayCast(false)
			lo('>> mup0:', true)
		local key = forKey(rayCast)
--        local rCast = cameraMouseRayCast(false)
--			U.dump(dforest[key], '?? for_forest:'..tostring(scope)..':'..tostring(dforest[key] and dforest[key].type or nil)..':'..tostring(key)..'/'..tostring(cedit.forest)..':'..tostring(cedit.fscope)) --..':'..tostring(rCast.object.name)) --..':'..tostring(dforest[key].mesh)..':'..tostring(cedit.fscope))
		if im.IsWindowHovered(im.HoveredFlags_AnyWindow) or im.IsAnyItemHovered() then return end
		local rayCast = cameraMouseRayCast(true)
		if false and rayCast and not N.out.inseed and not W.ui.injunction then

--    rayCast = cameraMouseRayCast(true)
	local nm = rayCast.object.name

--    local rayCast = cameraMouseRayCast(true)
	cedit.cval = {}
	if cedit.mesh == nil then return end
--    local rayCast = cameraMouseRayCast(true)
	if rayCast == nil then return end
									local a,b = v+vec3(0,0,H),v+vec3(0,0,H+desc.afloor[i].h)
									rayCast = cameraMouseRayCast(false)
									if U.angDistVert(a,b) then
		else
			if mup(cameraMouseRayCast(true), {D = D}) then
				return
		else
			if mwheel(w, cameraMouseRayCast(true)) then return end
		end
	if out.inseed then
		local rayCast = cameraMouseRayCast(false, im.flags(SOTTerrain))
		if rayCast then
--            if editor.keyModifiers.alt then
--                lo('?? for_ALT:'..tostring(cameraMouseRayCast(false).object.name))
--            end

	local rayCast,rayCastHit = cameraMouseRayCast(false)
	if rayCast then
--        if im.IsMouseClicked(0) then
--            lo('?? for_RCSDSS:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name))
--        end
--        if im.IsMouseClicked(0) then
--            lo('?? for_RCSDSS:'..tostring(cameraMouseRayCast(true).object.name)..':'..tostring(cameraMouseRayCast(false).object.name))
--        end
@/lua/ge/extensions/editor/buildingEditor.lua

	local rayCast = cameraMouseRayCast(true)
	if rayCast == nil then
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
		local nm = rayCast.object.name
--		    lo('?? CE.RC:'..tostring(nm)..':'..tostring(rayCast.pos)) --..' true:'..tostring(cameraMouseRayCast(true).object.name)..' false:'..tostring(cameraMouseRayCast(false).object.name)) --..':'..tostring(editor.selection.forestItem)
		if nm ~= nil then
	if im.IsMouseClicked(0) then
--            lo('?? MC:'..cameraMouseRayCast(true).object.name)
		if not im.IsWindowHovered(im.HoveredFlags_AnyWindow) and not im.IsAnyItemHovered() then
	if im.IsMouseReleased(0) then
		if false and W.mup(cameraMouseRayCast(true), {R = R, D = D}) then
			return
		if false then
			if W.mwheel(w, cameraMouseRayCast(true)) then
			elseif U._PRD == 0 and #Net.sregion == 1 then
@/lua/ge/extensions/editor/roadEditor.lua
  if core_forest.getForestObject() then core_forest.getForestObject():disableCollision() end
  local rayCast = cameraMouseRayCast()
  if core_forest.getForestObject() then core_forest.getForestObject():enableCollision() end
@/lua/ge/extensions/gameplay/rally/test/testRouteFix.lua
local function drawMousePos()
  local mousePos = cameraMouseRayCast()
  if mousePos and mousePos.pos then
@/lua/ge/extensions/editor/decalEditor.lua
local function onUpdate()
  local res = cameraMouseRayCast()
  local campos = core_camera.getPosition()