GE Lua Documentation

Press F to search!

getCrawlerDirection

Definition


-- @/lua/ge/extensions/gameplay/crawl/utils.lua:1336

M.getCrawlerDirection = function(crawlerId)
  local state = crawlStates[crawlerId]
  if not state or not state.crawlerData then
    return quat(0, 0, 0, 1)
  end

  local veh = state.crawlerData.dynamicData.vehObj
  if not veh then
    return quat(0, 0, 0, 1)
  end

  local vehicleRotation = veh:getRotation()
  local yaw = math.atan2(vehicleRotation.y, vehicleRotation.w) * 2
  return quat(math.cos(yaw * 0.5), 0, 0, math.sin(yaw * 0.5))
end

Callers

@/lua/ge/extensions/gameplay/crawl/flowgraphBridge.lua
    crawlerPosition = gameplay_crawl_utils.getCrawlerPosition(activeCrawlerId),
    crawlerDirection = gameplay_crawl_utils.getCrawlerDirection(activeCrawlerId),
    vehicleId = activeCrawlerId
@/lua/ge/extensions/gameplay/crawl/crawlFlowgraphBridge.lua
    crawlerPosition = gameplay_crawl_utils.getCrawlerPosition(bridgeState.activeCrawlerId),
    crawlerDirection = gameplay_crawl_utils.getCrawlerDirection(bridgeState.activeCrawlerId),
    vehicleId = bridgeState.activeCrawlerId