GE Lua Documentation

Press F to search!

push3

Definition


-- @/lua/common/mathlib.lua:698

function push3(x, y, z)
  local s = stackv3[stacki]
  if rawequal(y, nil) then
    s.x, s.y, s.z = x:xyz()
  else
    s.x, s.y, s.z = x, y, z
  end
  stacki = stacki + 1
  return push3obj
end

Callers

@/lua/vehicle/mapmgr.lua
    local edge = graph[currRoads[i]][currRoads[i+1]]
    local score = push3(dir):dot((push3(nodePositions[edge.outNode]) - push3(nodePositions[edge.inNode])):normalized())
    if not edge.oneWay then score = math.abs(score) end -- manage edges with multiple directions
    local edge = graph[currRoads[i]][currRoads[i+1]]
    local score = push3(dir):dot((push3(nodePositions[edge.outNode]) - push3(nodePositions[edge.inNode])):normalized())
    if not edge.oneWay then score = math.abs(score) end -- manage edges with multiple directions
    local edge = graph[currRoads[i]][currRoads[i+1]]
    local score = push3(dir):dot((push3(nodePositions[edge.outNode]) - push3(nodePositions[edge.inNode])):normalized())
    if not edge.oneWay then score = math.abs(score) end -- manage edges with multiple directions
@/lua/ge/extensions/core/cameraModes/free.lua
    forceVec:setScaled2(acc, data.dt) -- Acceleration
    forceVec:set(push3(forceVec) - push3(self.angularVelocity) * math.min(self.angularDrag * data.dt, 1)) -- Drag
    self.angularVelocity:setAdd(forceVec)
    forceVec:setScaled2(acc, data.dt) -- Acceleration
    forceVec:set(push3(forceVec) - push3(self.angularVelocity) * math.min(self.angularDrag * data.dt, 1)) -- Drag
    self.angularVelocity:setAdd(forceVec)

  self.rot:set(push3(self.rot) + push3(self.angularVelocity) * data.dt) -- Rotate
  self.rot.y = clamp(self.rot.y, -1.5706, 1.5706)

  self.rot:set(push3(self.rot) + push3(self.angularVelocity) * data.dt) -- Rotate
  self.rot.y = clamp(self.rot.y, -1.5706, 1.5706)
    forceVec:setScaled2(acc, data.dt) -- Acceleration
    forceVec:set(push3(forceVec) - push3(self.velocity) * math.min(self.translationDrag * data.dt, 1)) -- Drag
    self.velocity:setAdd(forceVec)
    forceVec:setScaled2(acc, data.dt) -- Acceleration
    forceVec:set(push3(forceVec) - push3(self.velocity) * math.min(self.translationDrag * data.dt, 1)) -- Drag
    self.velocity:setAdd(forceVec)
  tempVec:setRotate(qdir, self.velocity)
  self.pos:set(push3(self.pos) + push3(tempVec) * data.dt) -- Move
  tempVec:setRotate(qdir, self.velocity)
  self.pos:set(push3(self.pos) + push3(tempVec) * data.dt) -- Move
@/lua/ge/extensions/tech/multiscreen.lua
      if view.offsetNode then
        pos:setAdd(push3(veh:getNodePositionXYZ(view.offsetNode)))
      end
@/lua/ge/extensions/core/cameraModes/driver.lua
  -- Smooth velocity using rock on a string algorithm
  self.rockPos:set(push3(self.rockPos) - push3(data.vel) * data.dt)
  projectedRockPos:setProjectToOriginPlane(carUp, self.rockPos)
  -- Smooth velocity using rock on a string algorithm
  self.rockPos:set(push3(self.rockPos) - push3(data.vel) * data.dt)
  projectedRockPos:setProjectToOriginPlane(carUp, self.rockPos)
  carRot:setFromDir(carFwd, carUp)
  camRot:setFromDir(-push3(carFwd))
  camUp:setRotate(camRot, vecZ)
  camUp:setRotate(camRot, vecZ)
  local carRoll = math.atan2(push3(camUp):dot(-push3(carLeft)), camUp:dot(carUp))
  local carRollFactor = 1 - self.stableHorizonFactor * smootheststep(clamp(1.42*carUp.z, 0, 1))
  camUp:setRotate(camRot, vecZ)
  local carRoll = math.atan2(push3(camUp):dot(-push3(carLeft)), camUp:dot(carUp))
  local carRollFactor = 1 - self.stableHorizonFactor * smootheststep(clamp(1.42*carUp.z, 0, 1))
  -- Look-ahead angle
  self.fwdSpeed = lerp(self.fwdSpeed, -data.vel:length() * push3(data.vel):normalized():dot(carFwd), data.dt * ( 1.5 - self.lookAheadSmoothness))
  nRockPos:set(push3(carFwd) * (1 - self.rockPos:length() / self.lookAheadSmoothness) + self.rockPos)
  self.fwdSpeed = lerp(self.fwdSpeed, -data.vel:length() * push3(data.vel):normalized():dot(carFwd), data.dt * ( 1.5 - self.lookAheadSmoothness))
  nRockPos:set(push3(carFwd) * (1 - self.rockPos:length() / self.lookAheadSmoothness) + self.rockPos)
  nRockPos:normalize()
  -- application
  intermediateCamPos:set(push3(combinedPos) + self.seatPosition + rotationOffset)
  data.res.pos:setRotate(carRot, intermediateCamPos)
@/lua/ge/extensions/core/cameraModes/orbit.lua
  -- calculate the camera offset: rotate with the vehicle
  nx:set(push3(left) - ref)
  ny:set(push3(back) - ref)
  nx:set(push3(left) - ref)
  ny:set(push3(back) - ref)
  nz:set(push3(nx):cross(ny))
  ny:set(push3(back) - ref)
  nz:set(push3(nx):cross(ny))
  ny:set(push3(nx):cross(-push3(nz)))
  nz:set(push3(nx):cross(ny))
  ny:set(push3(nx):cross(-push3(nz)))
  nx:normalize()
  nz:set(push3(nx):cross(ny))
  ny:set(push3(nx):cross(-push3(nz)))
  nx:normalize()
    if not self.camOffset2 then self.camOffset2 = vec3() end
    self.camOffset2:set(push3(nx) * self.camBase.x + push3(ny) * self.camBase.y + push3(nz) * self.camBase.z)
    targetPos:set(push3(data.pos) + ref + self.camOffset2)
    if not self.camOffset2 then self.camOffset2 = vec3() end
    self.camOffset2:set(push3(nx) * self.camBase.x + push3(ny) * self.camBase.y + push3(nz) * self.camBase.z)
    targetPos:set(push3(data.pos) + ref + self.camOffset2)
    if not self.camOffset2 then self.camOffset2 = vec3() end
    self.camOffset2:set(push3(nx) * self.camBase.x + push3(ny) * self.camBase.y + push3(nz) * self.camBase.z)
    targetPos:set(push3(data.pos) + ref + self.camOffset2)
    self.camOffset2:set(push3(nx) * self.camBase.x + push3(ny) * self.camBase.y + push3(nz) * self.camBase.z)
    targetPos:set(push3(data.pos) + ref + self.camOffset2)
  end
    if self.lockCamera == true then
      camdir:set(push3(self.camLastTargetPos) - self.camLastPos2)
      if sign((push3(targetPos) - self.camLastTargetPos):dot(camdir)) < 0 then
      camdir:set(push3(self.camLastTargetPos) - self.camLastPos2)
      if sign((push3(targetPos) - self.camLastTargetPos):dot(camdir)) < 0 then
        self.camRot.x = self.camRot.x + 180
        self.camLastRot.x = self.camLastRot.x + math.pi
        self.camLastPos2:set(push3(targetPos) + camdir)
        self.camLastPosPerp:set(push3(vecZ):cross(camdir):normalized() * (self.relaxation * -0.8) + targetPos)
        self.camLastPos2:set(push3(targetPos) + camdir)
        self.camLastPosPerp:set(push3(vecZ):cross(camdir):normalized() * (self.relaxation * -0.8) + targetPos)
      end
  if self.cameraResetted ~= 1 then
    lastCamPointVec:set(push3(targetPos) - self.camLastPos2)
    lastCamLastPerp:set(push3(self.camLastPosPerp) - targetPos)
    lastCamPointVec:set(push3(targetPos) - self.camLastPos2)
    lastCamLastPerp:set(push3(self.camLastPosPerp) - targetPos)
    if lastCamPointVec:length() < self.relaxation and lastCamLastPerp:length() > self.relaxation * 0.8 then
    if lastCamPointVec:length() < self.relaxation and lastCamLastPerp:length() > self.relaxation * 0.8 then
      moveDir:set(push3(targetPos) - self.camLastTargetPos); moveDir:normalize()
      if math.abs(push3(lastCamPointVec):normalized():dot(moveDir)) > math.abs(push3(lastCamLastPerp):normalized():dot(moveDir)) then
      moveDir:set(push3(targetPos) - self.camLastTargetPos); moveDir:normalize()
      if math.abs(push3(lastCamPointVec):normalized():dot(moveDir)) > math.abs(push3(lastCamLastPerp):normalized():dot(moveDir)) then
        self.camLastPos2:set(push3(lastCamPointVec):cross(lastCamLastPerp):cross(lastCamLastPerp):normalized() + targetPos)
      moveDir:set(push3(targetPos) - self.camLastTargetPos); moveDir:normalize()
      if math.abs(push3(lastCamPointVec):normalized():dot(moveDir)) > math.abs(push3(lastCamLastPerp):normalized():dot(moveDir)) then
        self.camLastPos2:set(push3(lastCamPointVec):cross(lastCamLastPerp):cross(lastCamLastPerp):normalized() + targetPos)
      if math.abs(push3(lastCamPointVec):normalized():dot(moveDir)) > math.abs(push3(lastCamLastPerp):normalized():dot(moveDir)) then
        self.camLastPos2:set(push3(lastCamPointVec):cross(lastCamLastPerp):cross(lastCamLastPerp):normalized() + targetPos)
        lastCamPointVec:set(push3(targetPos) - self.camLastPos2)
        self.camLastPos2:set(push3(lastCamPointVec):cross(lastCamLastPerp):cross(lastCamLastPerp):normalized() + targetPos)
        lastCamPointVec:set(push3(targetPos) - self.camLastPos2)
      end
    local coef = math.sqrt(math.max(0, 1 - dirxylen))
    dir:set(push3(dir) * math.max(0, 1 - coef) + push3(dirxy) * (coef / (dirxylen + 1e-30)))
    dir:normalize()
    local coef = math.sqrt(math.max(0, 1 - dirxylen))
    dir:set(push3(dir) * math.max(0, 1 - coef) + push3(dirxy) * (coef / (dirxylen + 1e-30)))
    dir:normalize()

  lastCamPointVec:set(push3(self.camLastPos2) - targetPos)
  self.camLastPos2:set(push3(lastCamPointVec) * (self.relaxation / (lastCamPointVec:length() + 1e-30)) + targetPos)
  lastCamPointVec:set(push3(self.camLastPos2) - targetPos)
  self.camLastPos2:set(push3(lastCamPointVec) * (self.relaxation / (lastCamPointVec:length() + 1e-30)) + targetPos)

  camPos:set(push3(calculatedCamPos) + targetPos + self.orbitOffset)
  updir:setCross(vecZ, dir)
  updir:setCross(vecZ, dir)
  self.camLastPosPerp:set(push3(updir) * (self.relaxation * -0.8 / (updir:length() + 1e-30)) + targetPos)
  self.camLastTargetPos:set(targetPos)
  self.camVel:set((push3(camPos) - self.camLastPos) / data.dt)
  self.camLastPos:set(camPos)

  resultRot:setFromDir(push3(targetPos) - camPos)
  resultRot:setMul2(self.dynamicPitchQuat, resultRot)
@/lua/ge/extensions/core/cameraModes/onboard.lua
    camLeft:setSub2(ref, left); camLeft:normalize()
    camUp:set(-(push3(dir):cross(push3(camLeft)))); camUp:normalize()
  end
    camLeft:setSub2(ref, left); camLeft:normalize()
    camUp:set(-(push3(dir):cross(push3(camLeft)))); camUp:normalize()
  end
@/lua/ge/extensions/editor/trafficManager.lua
  -- Calculate Road direction vector
  local p2p1DirVec = (push3(p2) - p1):normalized():copy()
  -- Calculate the normalized position along the road segment
  -- lateral direction vector to the surface made by normal and p2p1DirVec
  local lateralDirVec = push3(p2p1DirVec):cross(normal):normalized():copy()
  -- lateral x norm

  spawnPos:set(((lane - 0.5) * laneWidth - radius) * push3(lateralDirVec) + spawnPos) -- spawn position
  p2p1DirVec:setScaled((lanes:byte(lane) == 43 and 1 or -1)) -- spawn direction
@/lua/vehicle/recovery.lua
    if not isFreeCamActive then
      camPos:set((push3(oobb[1])+oobb[4])/2 + push3(upVector) * (oobb[2].z-oobb[1].z) * 1.3 + (push3(oobb[3])-oobb[1]) * 1.5 + push3(backVec))
      tempVec:setSub2(dirFront, camOffsetVec)
    if not isFreeCamActive then
      camPos:set((push3(oobb[1])+oobb[4])/2 + push3(upVector) * (oobb[2].z-oobb[1].z) * 1.3 + (push3(oobb[3])-oobb[1]) * 1.5 + push3(backVec))
      tempVec:setSub2(dirFront, camOffsetVec)
    if not isFreeCamActive then
      camPos:set((push3(oobb[1])+oobb[4])/2 + push3(upVector) * (oobb[2].z-oobb[1].z) * 1.3 + (push3(oobb[3])-oobb[1]) * 1.5 + push3(backVec))
      tempVec:setSub2(dirFront, camOffsetVec)
    if not isFreeCamActive then
      camPos:set((push3(oobb[1])+oobb[4])/2 + push3(upVector) * (oobb[2].z-oobb[1].z) * 1.3 + (push3(oobb[3])-oobb[1]) * 1.5 + push3(backVec))
      tempVec:setSub2(dirFront, camOffsetVec)
@/lua/vehicle/ai.lua
        local nodePos = mapData.positions[nodeId]
        local dirRatio = max(0, (push3(mapData.positions[newNode.nextNodeInPath or newNode.id]) - newNode.posOrig):normalized():dot((push3(newNode.posOrig) - nodePos):normalized()))
        local drivabilityRatio = min(1, edgeData.drivability * inEdgeDrivabilityInv)
        local nodePos = mapData.positions[nodeId]
        local dirRatio = max(0, (push3(mapData.positions[newNode.nextNodeInPath or newNode.id]) - newNode.posOrig):normalized():dot((push3(newNode.posOrig) - nodePos):normalized()))
        local drivabilityRatio = min(1, edgeData.drivability * inEdgeDrivabilityInv)
    local thisLaneLatPos = (thisLaneLimRight + thisLaneLimLeft) * 0.5
    local laneColinearity = ((thisLaneLatPos * 2 - 1) * push3(newNodeWidthVec) + newEdgeVec):normalized():dot(dirVec)
    local colinearityError = 1 - max(0, laneColinearity)
    if plan[planCount].nextNodeInPath ~= path[nextPathIdx] then
      local norm1 = (push3(plan[planCount-1].posOrig) - plan[planCount].posOrig):cross(plan[planCount].biNormal):normalized():copy()
      local norm2 = (push3(plan[planCount].posOrig) - newNode.posOrig):cross(plan[planCount].biNormal):normalized():copy()
      local norm1 = (push3(plan[planCount-1].posOrig) - plan[planCount].posOrig):cross(plan[planCount].biNormal):normalized():copy()
      local norm2 = (push3(plan[planCount].posOrig) - newNode.posOrig):cross(plan[planCount].biNormal):normalized():copy()
      plan[planCount].normal:setAdd2(norm1, norm2)
  else
    plan[planCount].normal:set((push3(plan[planCount].posOrig) - newNode.posOrig):cross(plan[planCount].biNormal):normalized())
  end
    local wp1Pos, wp2Pos = mapData:getEdgePositions(newNode.prevNodeInPath, newNode.id)
    newNode.inEdgeNormal = (push3(wp1Pos) - wp2Pos):cross(newNode.biNormal):normalized():copy()
  else
    local wp1Pos, wp2Pos = mapData:getEdgePositions(newNode.id, newNode.nextNodeInPath)
    newNode.outEdgeNormal = (push3(wp1Pos) - wp2Pos):cross(newNode.biNormal):normalized():copy()
  else

    newNode.pos:setAdd(((newNode.laneLimLeft + newNode.laneLimRight) - 1) * newNode.halfWidth * push3(newNode.normal))

    newNode.inEdgeNormal:set((push3(plan[planCount].pos) - newNode.pos):cross(newNode.biNormal):normalized())
    -- keep inside lanes narrower
    if (push3(mapData.positions[newNode.nextNodeInPath]) - newNode.posOrig + mapData.positions[newNode.prevNodeInPath] - newNode.posOrig):dot(newNode.normal) < 0 then -- = turnDir * normal
      newNode.laneLimLeft = linearScale(newNode.rangeLeft, 0, 1, -newNode.halfWidth, newNode.halfWidth) + (bestLane - newNodeRangeLeftIdx) * laneWidth

  newNode.pos:set(newNode.lateralXnorm * push3(newNode.normal) + newNode.posOrig)
        v.width = v.vy:length() * 2
        local check_ahead = (ego.length * push3(ego.dirVec) - ego.pos + v.posFront):dot(ego.dirVec) > 0 --(v.posFront - (ego.pos - ego.length * ego.dirVec)):dot(ego.dirVec) > 0
        plan.distancesV = check_ahead and min(ego.pos:squaredDistance(v.posMiddle), plan.distancesV) or plan.distancesV
        newNode.normal:setAdd2(
          (push3(newNode.biNormal):cross(plan[i].normal)):cross(newNode.biNormal):normalized(),
          (push3(newNode.biNormal):cross(plan[i+1].normal)):cross(newNode.biNormal):normalized()
          (push3(newNode.biNormal):cross(plan[i].normal)):cross(newNode.biNormal):normalized(),
          (push3(newNode.biNormal):cross(plan[i+1].normal)):cross(newNode.biNormal):normalized()
        )
      local _, t2 = closestLinePoints(newNode.pos, newNode.pos + newNode.normal, n1.posOrig, n2.posOrig)
      newNode.posOrig:set(t2 * (push3(n2.posOrig) - n1.posOrig) + n1.posOrig)
      local edgeNormal = (push3(n1.posOrig) - n2.posOrig):cross(newNode.biNormal):normalized():copy()
      newNode.posOrig:set(t2 * (push3(n2.posOrig) - n1.posOrig) + n1.posOrig)
      local edgeNormal = (push3(n1.posOrig) - n2.posOrig):cross(newNode.biNormal):normalized():copy()
      local _, t2 = closestLinePoints(newNode.posOrig, newNode.posOrig + newNode.normal, plan[i].posOrig + plan[i].radiusOrig * edgeNormal, plan[i+1].posOrig + plan[i+1].radiusOrig * edgeNormal)
        planL[planL.planCount].lateralXnorm = planL[planL.planCount].lateralXnorm + (planL.offset or 0)
        planL[planL.planCount].pos:set(planL[planL.planCount].lateralXnorm * push3(planL[planL.planCount].normal) + planL[planL.planCount].posOrig)
        planL[planL.planCount].vec:setSub2(planL[planL.planCount-1].pos, planL[planL.planCount].pos); planL[planL.planCount].vec.z = 0
        planR[planR.planCount].lateralXnorm = planR[planR.planCount].lateralXnorm + (planR.offset or 0)
        planR[planR.planCount].pos:set(planR[planR.planCount].lateralXnorm * push3(planR[planR.planCount].normal) + planR[planR.planCount].posOrig)
        planR[planR.planCount].vec:setSub2(planR[planR.planCount-1].pos, planR[planR.planCount].pos); planR[planR.planCount].vec.z = 0
          local n = vec3(-ego.dirVec.y, ego.dirVec.x, 0); n:normalize()
          local rearEgoPos2TargetPos = (ego.length * push3(ego.dirVec) + mainPlan.targetPos - ego.pos):copy()
          local d = vec3()
            -- acc_check: check if overtake respects grip limit
            d:set(-0.1 * push3(mainPlan[mainPlan.targetSeg].normal) + rearEgoPos2TargetPos) -- (targetPos + dispLim) - (ego.pos - ego.length * ego.dirVec)
            local dSqLengthInv = 1/(d:squaredLength() + 1e-30)
            -- acc_check: check if overtake respects grip limit
            d:set(0.1 * push3(mainPlan[mainPlan.targetSeg].normal) + rearEgoPos2TargetPos) -- (targetPos + dispLim) - (ego.pos - ego.length * ego.dirVec)
            local dSqLengthInv = 1/(d:squaredLength() + 1e-30)
            local targetPos = plan_index == 1 and currentRoute.planL.targetPos or currentRoute.planR.targetPos
            local targetError = (push3(mainPlan.targetPos) - targetPos):dot(mainPlan[mainPlan.targetSeg].normal)
            if square(targetError) < 0.8 or (plan_index == 1 and targetError < 0) or (plan_index == 2 and targetError > 0) then
@/lua/ge/extensions/core/cameraModes/collision.lua

  dir:set(push3(data.res.pos) - data.res.targetPos)
  local dirLength = dir:length()
  -- Calculate nearClip dimensions
  nearClipCenter:set(push3(data.res.targetPos) + push3(dir) * ((dirLength - assumedNearClipDist) / dirLength))
  -- Calculate nearClip dimensions
  nearClipCenter:set(push3(data.res.targetPos) + push3(dir) * ((dirLength - assumedNearClipDist) / dirLength))
  lastNearClipCenter:set(nearClipCenter)
  newCamPos:set(push3(data.res.targetPos) + push3(dir):normalized() * (smoothedDistance + assumedNearClipDist))
  if useRaycast then
  lastNearClipCenter:set(nearClipCenter)
  newCamPos:set(push3(data.res.targetPos) + push3(dir):normalized() * (smoothedDistance + assumedNearClipDist))
  if useRaycast then
@/lua/ge/extensions/gameplay/drift/drift.lua
  oobbCenter:set(be:getObjectOOBBCenterXYZ(vehId))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  oobbCenter:set(be:getObjectOOBBCenterXYZ(vehId))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  oobbCenter:set(be:getObjectOOBBCenterXYZ(vehId))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  oobbCenter:set(be:getObjectOOBBCenterXYZ(vehId))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  oobbCenter:set(be:getObjectOOBBCenterXYZ(vehId))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FL:set(-push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_FR:set(-push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  center:set(
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  center:set(
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  center:set(
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  center:set(
  corner_BR:set(push3(halfAxis1)+push3(oobbCenter)+push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  corner_BL:set(push3(halfAxis1)+push3(oobbCenter)-push3(halfAxis0)-push3(halfAxis2)+push3(raycastHeightVec))
  center:set(

  velDir:set(push3(vehicleData.vel):normalized())
@/lua/common/mathlib.lua
function LuaVec3:setTrianglePointFromUV(a, b, c, u, v)
  self:set(push3(a) * u + push3(b) * v + push3(c) * (1-u-v))
end
function LuaVec3:setTrianglePointFromUV(a, b, c, u, v)
  self:set(push3(a) * u + push3(b) * v + push3(c) * (1-u-v))
end
function LuaVec3:setTrianglePointFromUV(a, b, c, u, v)
  self:set(push3(a) * u + push3(b) * v + push3(c) * (1-u-v))
end
  local x, y, z = (a or self):xyz()
  local tx,ty,tz = (push3(q):cross(push3(x,y,z)) * 2):xyz()
  self:set(push3(x,y,z) - push3(tx,ty,tz) * q.w + push3(q):cross(push3(tx,ty,tz)))
  local x, y, z = (a or self):xyz()
  local tx,ty,tz = (push3(q):cross(push3(x,y,z)) * 2):xyz()
  self:set(push3(x,y,z) - push3(tx,ty,tz) * q.w + push3(q):cross(push3(tx,ty,tz)))
  local tx,ty,tz = (push3(q):cross(push3(x,y,z)) * 2):xyz()
  self:set(push3(x,y,z) - push3(tx,ty,tz) * q.w + push3(q):cross(push3(tx,ty,tz)))
end
  local tx,ty,tz = (push3(q):cross(push3(x,y,z)) * 2):xyz()
  self:set(push3(x,y,z) - push3(tx,ty,tz) * q.w + push3(q):cross(push3(tx,ty,tz)))
end
  local tx,ty,tz = (push3(q):cross(push3(x,y,z)) * 2):xyz()
  self:set(push3(x,y,z) - push3(tx,ty,tz) * q.w + push3(q):cross(push3(tx,ty,tz)))
end
  local tx,ty,tz = (push3(q):cross(push3(x,y,z)) * 2):xyz()
  self:set(push3(x,y,z) - push3(tx,ty,tz) * q.w + push3(q):cross(push3(tx,ty,tz)))
end
function LuaVec3:rotated(q)
  local qv = newLuaVec3xyz((push3(q):cross(self) * 2):xyz())
  qv:set(push3(self) - push3(qv) * q.w + push3(q):cross(qv))
  local qv = newLuaVec3xyz((push3(q):cross(self) * 2):xyz())
  qv:set(push3(self) - push3(qv) * q.w + push3(q):cross(qv))
  return qv
  local qv = newLuaVec3xyz((push3(q):cross(self) * 2):xyz())
  qv:set(push3(self) - push3(qv) * q.w + push3(q):cross(qv))
  return qv
  local qv = newLuaVec3xyz((push3(q):cross(self) * 2):xyz())
  qv:set(push3(self) - push3(qv) * q.w + push3(q):cross(qv))
  return qv
  local s = stackv3[stacki]
  return string.format('push3(%.10g,%.10g,%.10g)', numSer(s.x), numSer(s.y), numSer(s.z))
end
  elseif (ffi and ffi.istype('struct __luaVec3_t', b)) or b.w == nil then
    local qv = newLuaVec3xyz((push3(a):cross(b) * 2):xyz())
    qv:set(push3(b) - push3(qv)*a.w + push3(a):cross(qv))
    local qv = newLuaVec3xyz((push3(a):cross(b) * 2):xyz())
    qv:set(push3(b) - push3(qv)*a.w + push3(a):cross(qv))
    return qv
    local qv = newLuaVec3xyz((push3(a):cross(b) * 2):xyz())
    qv:set(push3(b) - push3(qv)*a.w + push3(a):cross(qv))
    return qv
    local qv = newLuaVec3xyz((push3(a):cross(b) * 2):xyz())
    qv:set(push3(b) - push3(qv)*a.w + push3(a):cross(qv))
    return qv
  if abs(tmpv2:dot(tmpv1)) > 0.9999 then
    tmpv2:set((push3(tmpv2) + tmpv2:perpendicularN() * 1e-5):normalized())
  end
@/lua/ge/extensions/core/groundMarkerArrows.lua
      local nudgeForwardValue = proxy.nudgeForwardSmoother:get(proxy.nudgeForwardSmootherTarget, dt) -- Fade in over 0.5 seconds
      actualPos:setAdd(push3(fwd) * (nudgeForwardValue - 0.75))
@/lua/ge/extensions/freeroam/crashCamMode.lua

  futureOtherBBCenter:set(push3(be:getObjectOOBBCenterXYZ(otherId)) + push3(otherVel) * lookAheadTime)

  futureOtherBBCenter:set(push3(be:getObjectOOBBCenterXYZ(otherId)) + push3(otherVel) * lookAheadTime)

  playerVelNormalized:set(push3(playerVel):normalized())
  playerBBCenter:set(be:getObjectOOBBCenterXYZ(playerVehId))

  futurePlayerBBCenter:set(push3(playerBBCenter) + push3(playerVel) * lookAheadTime)

  futurePlayerBBCenter:set(push3(playerBBCenter) + push3(playerVel) * lookAheadTime)
    if not bottomPoints[1] then bottomPoints[1] = vec3() end
    bottomPoints[1]:set(push3(playerBBCenter) - push3(playerAxis1) * (halfExtentsY - 0.2))
    if not bottomPoints[1] then bottomPoints[1] = vec3() end
    bottomPoints[1]:set(push3(playerBBCenter) - push3(playerAxis1) * (halfExtentsY - 0.2))
      if not bottomPoints[counter] then bottomPoints[counter] = vec3() end
      bottomPoints[counter]:set(push3(bottomPoints[1]) - push3(playerAxis0) * offset)
      counter = counter + 1
      if not bottomPoints[counter] then bottomPoints[counter] = vec3() end
      bottomPoints[counter]:set(push3(bottomPoints[1]) - push3(playerAxis0) * offset)
      counter = counter + 1
      if not bottomPoints[counter] then bottomPoints[counter] = vec3() end
      bottomPoints[counter]:set(push3(bottomPoints[1]) + push3(playerAxis0) * offset)
      counter = counter + 1
      if not bottomPoints[counter] then bottomPoints[counter] = vec3() end
      bottomPoints[counter]:set(push3(bottomPoints[1]) + push3(playerAxis0) * offset)
      counter = counter + 1