placeTrailer
Definition
-- @/lua/ge/spawn.lua:1013
local function placeTrailer(vehId, couplerOffsetVeh, trailerId, couplerOffsetTrailer, couplerTag, rotOffset)
local veh = getObjectByID(vehId)
if not veh then return end
local veh2 = getObjectByID(trailerId)
if not veh2 then return end
local transform0 = veh:getRefNodeMatrix()
local coupler0_offset = couplerOffsetVeh--vec3(0, 3, 0.2)
local coupler1_offset = couplerOffsetTrailer--vec3(0.3, -3.3, 0)
local mat = calculateRelativeVehiclePlacement(transform0, coupler0_offset, coupler1_offset, rotOffset)
veh2:setTransform(mat)
veh2:queueLuaCommand('obj:requestReset(RESET_PHYSICS)')
veh2:resetBrokenFlexMesh()
if core_vehicles.couplerTagsOptions[couplerTag] == "autoCouple" then
veh:queueLuaCommand(string.format('beamstate.activateAutoCoupling("%s")', couplerTag))
end
end
Callers
@/gameplay/missions/west_coast_usa/chase/001-Goliath/script.lua
if valid then
spawn.placeTrailer(suspectId, nodeOffset1, trailerId, nodeOffset2, nodeTag)
--suspect:queueLuaCommand("beamstate.attachCouplers()")
@/lua/ge/extensions/core/trailerRespawn.lua
local vehCouplerTag = core_vehicles.vehsCouplerTags[vehId][trailerReg[vehId].node]
spawn.placeTrailer(vehId, vehCouplerOffset, trailerReg[vehId].trailerId, trailerCouplerOffset, vehCouplerTag)
end
local function placeTrailer(vehId)
if trailerReg[vehId] then
local vehCouplerTag = core_vehicles.vehsCouplerTags[vehId][trailerReg[vehId].node]
spawn.placeTrailer(vehId, vehCouplerOffset, trailerReg[vehId].trailerId, trailerCouplerOffset, vehCouplerTag)
end
local tmp = core_vehicles.vehsCouplerOffset[trailerReg[vehId].trailerId][trailerReg[vehId].trailerNode]
spawn.placeTrailer(vehId, core_vehicles.vehsCouplerOffset[vehId][trailerReg[vehId].node], trailerReg[vehId].trailerId, tmp, core_vehicles.vehsCouplerTags[vehId][trailerReg[vehId].node])
end