Code Script Lua Vehicle.
script.llanta1 = nil --entity "Llanta 1"
Script.llanta2 = nil --entity "Llanta 2"
Script.llanta3 = nil --entity "Llanta 3"
Script.llanta4 = nil --entity "Llanta 4"
function Script:Start()
InitVehiculo(self.entity)
end
function Script:UpdateWorld()
end
function Script:UpdatePhysics()
self.llanta1:SetMatrix(montaCarga:GetTireMatrix(0))
self.llanta2:SetMatrix(montaCarga:GetTireMatrix(1))
self.llanta3:SetMatrix(montaCarga:GetTireMatrix(2))
self.llanta4:SetMatrix(montaCarga:GetTireMatrix(3))
if window:KeyHit(Key.A ) then
self.entity:Translate( 0, 15, 0 )
self.entity:SetRotation(0,-90, 0 )
end
end
function InitVehiculo( malla )
montaCarga = Vehicle:Create( malla )
local ejePos = 0.6
local ejeAlt = 0.3
local posZ = 1
local radio = 0.35
local ancho = 0.3
montaCarga:AddTire( ejePos, -ejeAlt, posZ, 100, radio, ancho, false,200, 2000, 0.01)
montaCarga:AddTire( -ejePos, -ejeAlt, posZ, 100, radio, ancho, false ,200, 2000, 0.01)
montaCarga:AddTire( ejePos, -ejeAlt, -posZ+0.25 , 100, radio, ancho,false,200, 2000, 0.01)
montaCarga:AddTire( -ejePos, -ejeAlt, -posZ+0.25 , 100, radio, ancho,false,200, 2000, 0.01 )
montaCarga:AddAxle(0,1)
montaCarga:AddAxle(2,3)
montaCarga:Build()
montaCarga:SetEngineRunning( false )
montaCarga:SetHandBrakes(0)
end