VE Lua Documentation

Press F to search!

applyVelocity

Definition


-- @/lua/vehicle/thrusters.lua:137

local function applyVelocity(velocity, dt, nodeId)
  dt = dt or lastDt
  if dt == 0 then return end
  nodeId = nodeId or (v.data.refNodes and v.data.refNodes[0].cid) or 0
  applyAccel((velocity - obj:getClusterVelocityWithoutWheels(nodeId)) / dt, dt, nodeId)
end

Callers

@/lua/vehicle/controller/tech/tyreBarrier.lua
  if isPreamble then
    thrusters.applyVelocity(obj:getDirectionVector():normalized() * (initialVel + initalVelOffset) / 3.6, 0.5)
    local pos, vel = obj:getPosition(), obj:getVelocity()
@/lua/ge/extensions/flowgraph/nodes/vehicle/applyVelocity.lua
  dirVec:setScaled(self.pinIn.coefficient.value or 1)
  veh:queueLuaCommand("thrusters.applyVelocity("..serialize(dirVec)..")")
end
@/lua/vehicle/extensions/tech/techCore.lua
M.handleSetVelocity = function(request)
  thrusters.applyVelocity(obj:getDirectionVector() * request['velocity'], request['dt'])
  request:sendACK('VelocitySet')
@/lua/ge/extensions/gameplay/traffic/vehicle.lua
          if self.respawnSpeed then
            -- obj:queueLuaCommand('thrusters.applyVelocity(obj:getDirectionVector() * '..(self.respawnSpeed * self.alpha)..')') -- makes vehicle start at speed
            -- NOTE: test this to see if it can be enabled
@/lua/vehicle/scriptai.lua
      forceSpeedVec:setScaled(s1.forceSpeed / (forceSpeedVec:length() + 1e-30))
      thrusters.applyVelocity(forceSpeedVec, dt)
      s1.forceSpeed = nil