Hello. Function in Vehicle class "SetAcceleration" don't work after update. The car stand still and isn't driving, only work steering function and is moving by inertia. I used lua script for create vehicle. Please, help me!
Code of my test script:
function Script:Start()
vehicle = Vehicle:Create(self.entity)
local tiremodel={}
table.insert(tiremodel,4)
for i=0,3 do
tiremodel[i]=self.entity:FindChild("w"..i)
tiremodel[i]:SetShape(nil)
if i < 2 then
vehicle:AddTire(tiremodel[i],true)
else
vehicle:AddTire(tiremodel[i])
end
end
vehicle:AddAxle(0,1)
vehicle:AddAxle(2,3)
if vehicle:Build()==false then
Debug:Error("Failed to build vehicle.")
end
vehicle:SetEngineRunning(true)
vehicle:SetTransmissionMode(true)
vehicle:SetHandBrakes(0)
end
function Script:UpdatePhysics()
local steering=0
if window:KeyDown(Key.A) then steering=steering+30 end
if window:KeyDown(Key.D) then steering=steering-30 end
vehicle:SetSteering(steering)
local gas=0
if window:KeyDown(Key.W) then gas=gas + 0.1 end
if window:KeyDown(Key.S) then gas=gas - 0.1 end
vehicle:SetBrakes(0)
vehicle:SetHandBrakes(0)
vehicle:SetAcceleration(gas)
end