GE Lua Documentation

Press F to search!

onDrawDebug

Definition


-- @/lua/ge/extensions/scenario/scenarios.lua:1112


-- draws a debug visualization on the screen that should help the author of the scenario
local function onDrawDebug(focusPos)
  if not scenario then return end

  local drawDebug = tonumber(getConsoleVariable('$isEditorEnabled')) == 1 and settings.getValue("BeamNGRaceDrawDebug")

  if drawDebug and scenario.nodes then
    for nid, n in pairs(scenario.nodes) do
      if (n.pos - focusPos):length() < debugDrawDistance then
        -- draw nodes
        local pp = n.pos
        debugDrawer:drawSphere(pp, n.radius, ColorF(0.5,0.5,0.5,0.3))
        debugDrawer:drawText(pp, String(tostring(nid)), ColorF(0,0,0,1))
      end
    end
  end
end

Callers

@/lua/ge/extensions/scenario/raceDebug.lua

local function onDrawDebug(focusPos)
  local currentScenario = scenario_scenarios.getScenario()
@/lua/ge/extensions/core/replay.lua
-- TODO:
--local function onDrawDebug(lastDebugFocusPos, dtReal, dtSim, dtRaw)
  -- 1) get the current replay frame (current VehicleState)
@/lua/ge/extensions/editor/scriptAIManager.lua

local function onDrawDebug(lastDebugFocusPos, dtReal, dtSim, dtRaw)
  if not debugPath[0] or not (editor.isWindowVisible and editor.isWindowVisible(toolWindowName)) then return end