GE Lua Documentation

Press F to search!

overlapsOBB_OBB

Definition


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

function overlapsOBB_OBB(c1, x1, y1, z1, c2, x2, y2, z2)
  tmpv1:setSub2(c1, c2)
  local d11,d12,d13=abs(x1:dot(x2)),abs(x1:dot(y2)),abs(x1:dot(z2))
  if abs(tmpv1:dot(x1))-d11-d12-d13>x1:squaredLength() then return false end
  local d21,d22,d23=abs(y1:dot(x2)),abs(y1:dot(y2)),abs(y1:dot(z2))
  if abs(tmpv1:dot(y1))-d21-d22-d23>y1:squaredLength() then return false end
  local d31,d32,d33=abs(z1:dot(x2)),abs(z1:dot(y2)),abs(z1:dot(z2))
  return abs(tmpv1:dot(z1))-d31-d32-d33<=z1:squaredLength() and abs(tmpv1:dot(x2))-d11-d21-d31<=x2:squaredLength()
     and abs(tmpv1:dot(y2))-d12-d22-d32<=y2:squaredLength() and abs(tmpv1:dot(z2))-d13-d23-d33<=z2:squaredLength()
     and axisCheck(x1,x2,y1,z1,y2,z2) and axisCheck(x1,y2,y1,z1,x2,z2) and axisCheck(x1,z2,y1,z1,x2,y2)
     and axisCheck(y1,x2,x1,z1,y2,z2) and axisCheck(y1,y2,x1,z1,x2,z2) and axisCheck(y1,z2,x1,z1,x2,y2)
     and axisCheck(z1,x2,x1,y1,y2,z2) and axisCheck(z1,y2,x1,y1,x2,z2) and axisCheck(z1,z2,x1,y1,x2,y2)
end

Callers

@/lua/ge/extensions/core/cameraModes/crash.lua
local function bbsIntersect(bb1, bb2)
  return overlapsOBB_OBB(bb1:getCenter(), bb1:getAxis(0) * bb1:getHalfExtents().x, bb1:getAxis(1) * bb1:getHalfExtents().y, bb1:getAxis(2) * bb1:getHalfExtents().z, bb2:getCenter(), bb2:getAxis(0) * bb2:getHalfExtents().x, bb2:getAxis(1) * bb2:getHalfExtents().y, bb2:getAxis(2) * bb2:getHalfExtents().z)
end
@/lua/ge/extensions/gameplay/traffic/vehicle.lua

        if overlapsOBB_OBB(bb1:getCenter(), bb1:getAxis(0) * bb1:getHalfExtents().x, bb1:getAxis(1) * bb1:getHalfExtents().y, bb1:getAxis(2) * bb1:getHalfExtents().z, bb2:getCenter(), bb2:getAxis(0) * bb2:getHalfExtents().x, bb2:getAxis(1) * bb2:getHalfExtents().y, bb2:getAxis(2) * bb2:getHalfExtents().z) then
          self.collisions[id] = {state = 'active', inArea = false, speed = self.speed, vehDist = 0, damage = 0, dot = 0, count = 0, stop = 0}
@/lua/ge/extensions/career/modules/inventory.lua
        zoneExtents.z = math.min(zoneExtents.z, 10000)
        if overlapsOBB_OBB(vehBB:getCenter(), xVec * vehBBExtents.x, yVec * vehBBExtents.y, zVec * vehBBExtents.z,
                           zone.center, xVec * zoneExtents.x/2, yVec * zoneExtents.y/2, zVec * zoneExtents.z/2) then
@/lua/ge/extensions/gameplay/markers/parkingMarker.lua
    elseif self.mode == "overlap" then
      self.overlap = (data.cruisingSpeedFactor < 1) and overlapsOBB_OBB(self.pos, self.xVec, self.yVec, self.zVec, data.bbCenter, data.bbHalfAxis0, data.bbHalfAxis1, data.bbHalfAxis2)
    end
@/lua/ge/extensions/gameplay/markers/walkingMarker.lua

    local overlap = data.isWalking and (data.cruisingSpeedFactor < 1) and overlapsOBB_OBB(data.bbCenter, data.bbHalfAxis0, data.bbHalfAxis1, data.bbHalfAxis2, area.areaPos, area.xVec, area.yVec, area.zVec)
    anyOverlap = anyOverlap or overlap
@/lua/ge/spawn.lua

  if overlapsOBB_OBB(bbCenter, axis0 * halfExtentsX, axis1 * halfExtentsY, axis2 * halfExtentsZ, otherBBCenter, otherVehAxis1 * otherBBHalfExtents.x, otherVehAxis2 * otherBBHalfExtents.y, otherVehAxis3 * otherBBHalfExtents.z) then
    local vehID = otherVeh:getId()
@/lua/vehicle/ai.lua

        if overlapsOBB_OBB(v.posMiddle, v.vx, v.vy, v.vz, segC, segVx, segVy, segVz) then
          stopFlag = true
@/lua/ge/extensions/gameplay/markers/gasStationMarker.lua
    --simpleDebugText3d(idx, area.iconPos, 0.25)
    local overlap = (data.cruisingSpeedFactor < 1) and overlapsOBB_OBB(data.bbCenter, data.bbHalfAxis0, data.bbHalfAxis1, data.bbHalfAxis2, area.areaPos, area.xVec, area.yVec, area.zVec)
    anyOverlap = anyOverlap or overlap
@/lua/ge/extensions/freeroam/crashCamMode.lua
  local center2, xAxis2, yAxis2, zAxis2 = bb2:getCenterHalfExtentAxes()
  return overlapsOBB_OBB(center1, xAxis1, yAxis1, zAxis1, center2, xAxis2, yAxis2, zAxis2)
end

  if overlapsOBB_OBB(futurePlayerBBCenter, playerBBHalfAxis0, playerBBHalfAxis1, playerBBHalfAxis2, futureOtherBBCenter, otherBBHalfAxis0, otherBBHalfAxis1, otherBBHalfAxis2) then
    -- set the data and toggle the action cam