GE Lua Documentation

Press F to search!

upcast

Definition


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

Callers

@/lua/ge/extensions/editor/forestView.lua
  if forestObject then
    forestObject = Sim.upcast(forestObject)
  end
@/lua/ge/extensions/editor/api/objectHistoryActions.lua
      local serializeRecursively = function(fn, parent, tbl)
        parent = Sim.upcast(parent)
        tbl.json = "[" .. parent:serializeForEditor(true, -1, "group") .. "]"
@/lua/ge/extensions/core/busRouteManager.lua
      if trigger and trigger:getClassName() == "BeamNGTrigger" then
        trigger = Sim.upcast(trigger)  --cast again from cpp to lua wrapper
        if trigger.type == "busstop" then
@/lua/ge/extensions/editor/decalEditor.lua
    editor.selectObjectById(templates[templateSelectionIndex[0]+1]:getID())
    selectedTemplate = Sim.upcast(templates[templateSelectionIndex[0]+1])
    updateGizmoPos()
@/lua/ge/extensions/util/autoAnnotation.lua

  node = Sim.upcast(node)
visitors.visitForest = function(parent, node)
  node = Sim.upcast(node)
  for i, item in ipairs(node:getData():getItems()) do
@/lua/ge/extensions/scenario/scenarios.lua
    if to and to.obj and to.obj:getId() and prefabIsChildOfGroup(to.obj, 'ScenarioObjectsGroup') then
      to = Sim.upcast(to)
      local vehicleConf = scenario.vehicles['*']
@/lua/ge/extensions/gameplay/rally/tools/loopToolbox.lua
    -- Upcast the object to ensure we have full access to its methods
    obj = Sim.upcast(obj)
    if not obj then return end
@/lua/ge/extensions/editor/api/camera.lua
local function getObjectLocationText(obj)
  obj = Sim.upcast(obj)
  local mtx = obj:getTransform()
@/lua/ge/extensions/editor/roadSpline/import.lua
      local obj = name and scenetree.findObject(name)
      if obj and Sim.upcast(obj) then
        obj:delete()
    local road = decalRoads[i]
    if road and Sim.upcast(road) then
      local group = road:getGroup()
      road:delete()
      if group and Sim.upcast(group) and not cleanedGroups[group:getID()] then
        local onlyDecalRoads = true
          local sibling = group:at(j)
          if sibling and Sim.upcast(sibling) and sibling:getClassName() ~= "DecalRoad" then
            onlyDecalRoads = false
@/lua/ge/extensions/editor/particleEditor.lua
  editableEmitterNode:setField("name", 0, "editableEmitterNode")
  selectEmitter(Sim.upcast(particleEmitters[1]))
  local direction = editor.getCamera():getTransform():getColumn(1)
  end
  selectEmitter(Sim.upcast(particleEmitters[1]))
end
  updateDatablockList()
  selectEmitter(Sim.upcast(particleEmitters[1]))
end
          if im.Selectable1(string.format("%s (%s)", emitter:getName(), emitter:getField("particles", ""))) then
            selectEmitterFromMenu(Sim.upcast(emitter))
          end
@/lua/ge/extensions/core/audioRibbon.lua
    local emitter = createObject("SFXEmitter")
    emitter = Sim.upcast(emitter)
    if emitter then
    end
  return Sim.upcast(emitter)
end
@/lua/ge/extensions/editor/sceneTree.lua
        className = rootGrp:getClassName(),
        upcastedObject = Sim.upcast(rootGrp),
        open = true,
local function setOrder(object)
  local obj = Sim.upcast(object)
  table.insert(editor.orderTable, obj:getId())
        if prefabInstance then
          prefabInstance = Sim.upcast(prefabInstance)
          prefabInstance:updateChildOffsetTransform(id)
@/lua/ge/extensions/tech/techCore.lua
    for i=0, count - 1 do
      local child = getSceneTreeNode(Sim.upcast(obj:getObject(i)))
      table.insert(node.children, child)
M.handleGetSceneTree = function(request)
  local rootGrp = Sim.upcast(Sim.findObject('MissionGroup'))
  local tree = getSceneTreeNode(rootGrp)
local function getSerializedObject(obj)
  obj = Sim.upcast(obj)
  local class = obj:getClassName()
      for i = 0, count - 1 do
        local childObj = Sim.upcast(obj:getObject(i))
        local childNode = getSerializedObject(childObj)
M.handleSyncScene = function(request)
  local rootGrp = Sim.upcast(Sim.findObject('MissionGroup'))
  local tree = getSceneTreeNodeFull(rootGrp)
@/lua/ge/extensions/editor/audioEventsList.lua
  for i = 0, numEvents - 1 do
    local eventObj = Sim.upcast(Sim.getSFXTrackSet():getObject(i))
    local eventDesc = eventObj:getField("description", "")
@/lua/ge/extensions/scenario/busdriver.lua
    local trigger = scenetree.findObject(nextStop[1])
    trigger = Sim.upcast(trigger)
    -- local vUpVec=vec3(pv:getDirectionVectorUp())
@/lua/ge/extensions/core/sounds.lua
        local camObj = getCamera()
        camObj = (camObj and Sim.upcast(camObj)) or camObj
        globalParams:setParameterValue("g_CamFree", commands.isFreeCamera() and 1 or 0)
@/lua/ge/extensions/editor/barriersEditor.lua
          if name == 'TSStatic' then
            obj = Sim.upcast(obj)
            local pos = vec3(obj:getPosition())
@/lua/ge/extensions/editor/createObjectTool.lua
  if obj then
    instance = Sim.upcast(obj)
    obj:setName(newName)
  if rayCastInfo and currentClassInstance and currentClassInstance:isSubClassOf("SceneObject") then
    local obj = Sim.upcast(currentClassInstance)
  if obj then
    obj = Sim.upcast(obj)
    if obj then
@/lua/ge/extensions/util/renderComponentsAPI.lua
      if obj then
        obj = Sim.upcast(obj)
        if numBool ~= 0 then
@/lua/ge/ge_utils.lua
    if channel then
      channel = Sim.upcast(channel)
      callback(name, channel)
@/lua/ge/extensions/gameplay/missions/missionManager.lua
              if name == 'BeamNGVehicle' then
                sObj = Sim.upcast(sObj)
                mission._vehicleTransforms[sObj:getId()] = {
@/lua/ge/client/postFx/lightRay.lua
  local pfx = lightRayPostFX:findObjectByInternalName("final")-- scenetree.findObject("final")
  pfx = Sim.upcast(pfx)
  pfx:setShaderConst("$numSamples", TorqueScriptLua.getVar("$LightRayPostFX::numSamples"))
@/lua/ge/extensions/flowgraph/nodes/scene/rectMarker.lua

  local trigger = Sim.upcast(self.triggerObj)
  local front = ((vDirVec:dot(yVec) > 0) and 1 or 0) + 1
@/lua/ge/extensions/editor/meshSpline/import.lua
    local comp = components[i]
    comp.obj = Sim.upcast(comp.obj)
    local pos = vec3(comp.obj:getPosition())
    local obj = ordered[i].obj
    if obj and Sim.upcast(obj) then
      local group = obj:getGroup()
      obj:delete()
      if group and Sim.upcast(group) and not cleanedGroups[group:getID()] then
        local onlyTSStatics = true
          local sibling = group:at(j)
          if sibling and Sim.upcast(sibling) and sibling:getClassName() ~= "TSStatic" then
            onlyTSStatics = false
@/lua/ge/extensions/flowgraph/nodes/mission/knockAwayCheck.lua
    if veh then
      veh = Sim.upcast(veh)
      transforms[id] = {
@/lua/ge/extensions/editor/api/object.lua
  for i = 1, #found do
    local obj = Sim.upcast(found[i])
    if obj:isSubClassOf("SceneObject") then
@/lua/ge/extensions/editor/rendererComponents.lua

  DOFPostEffect = Sim.upcast(DOFPostEffect)
    if lightRayPostFX then
      lightRayPostFX = Sim.upcast(lightRayPostFX)
      if lightraysSettings['enable'].value then
  if DOFPostEffect then
    DOFPostEffect = Sim.upcast(DOFPostEffect)
    DOFPostEffect.debugModeEnabled = DOFSettings['enableDebugMode'].value
  if lightRayPostFX then
    lightRayPostFX = Sim.upcast(lightRayPostFX)
    if lightraysSettings['enable'].value then
@/lua/ge/extensions/editor/objectTool.lua
    -- The vehicles are special, display the position and the rotation of the reference nodes instead
    local veh = Sim.upcast(obj)
    local pos = veh:getPosition()
      if obj:getClassName() == "Prefab" then
        local pos = Sim.upcast(obj):getTransform():getColumn(3)
        local posString = "" .. pos.x .. " " .. pos.y .. " " .. pos.z
        local posString = "" .. pos.x .. " " .. pos.y .. " " .. pos.z
        local rot = Sim.upcast(obj):getRotation()
        local rotString = "" .. rot.x .. " " .. rot.y .. " " .. rot.z .. " " .. rot.w
        local rotString = "" .. rot.x .. " " .. rot.y .. " " .. rot.z .. " " .. rot.w
        local scale = Sim.upcast(obj):getScale()
        local scaleString = "" .. scale.x .. " " .. scale.y .. " " .. scale.z
        local name = obj:getName()
        local filename = Sim.upcast(obj):getField('filename', '')
        obj:delete()
        if obj:isSubClassOf("DecalRoad") then -- regenerate, so the BB is correct immediately
          Sim.upcast(obj):regenerate()
        end
        if prefabInstance then
          prefabInstance = Sim.upcast(prefabInstance)
          prefabInstance:updateChildOffsetTransform(objId)
@/lua/ge/extensions/editor/assemblySpline/import.lua
    local obj = components[i].obj
    if obj and Sim.upcast(obj) then
      local group = obj:getGroup()
      local group = obj:getGroup()
      if group and Sim.upcast(group) and not cleanedGroups[group:getID()] then
        local onlyTSStatics = true
          local sibling = group:at(j)
          if sibling and Sim.upcast(sibling) and sibling:getClassName() ~= "TSStatic" then
            onlyTSStatics = false
    local obj = components[i].obj
    if obj and Sim.upcast(obj) then
      obj:delete()
@/lua/ge/extensions/flowgraph/modules/prefabModule.lua
    if veh then
      veh = Sim.upcast(veh)
      transforms[id] = {