--
-- Teleskopladerser
--local maxKmh
-- M@D Author  StarT, ANUBIS95
-- M@D date  4.7.2012

Teleskopladerser = {}

function Teleskopladerser.prerequisitesPresent(specializations)
	Vehicle.registerJointType("frontloader");
    return true ;
end;

function Teleskopladerser:load(xmlFile)

    self.fanNode = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.fan#index"));




--[[windows]]------------------------------------------------------------
local rotationPartNoderightdoor = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rightdoor#index"));
    if rotationPartNoderightdoor ~= nil then
        self.rotationPartrightdoor = {};
        self.rotationPartrightdoor.node = rotationPartNoderightdoor;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rightdoor#minRot"));
        self.rotationPartrightdoor.minRot = {};
        self.rotationPartrightdoor.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrightdoor.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrightdoor.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rightdoor#maxRot"));
        self.rotationPartrightdoor.maxRot = {};
        self.rotationPartrightdoor.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrightdoor.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrightdoor.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartrightdoor.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rightdoor#rotTime"), 2)*1000;
        self.rotationPartrightdoor.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rightdoor#touchRotLimit"), 10));
    end;
local rotationPartNodeleftdoor = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.leftdoor#index"));
    if rotationPartNodeleftdoor ~= nil then
        self.rotationPartleftdoor = {};
        self.rotationPartleftdoor.node = rotationPartNodeleftdoor;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.leftdoor#minRot"));
        self.rotationPartleftdoor.minRot = {};
        self.rotationPartleftdoor.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartleftdoor.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartleftdoor.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.leftdoor#maxRot"));
        self.rotationPartleftdoor.maxRot = {};
        self.rotationPartleftdoor.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartleftdoor.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartleftdoor.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartleftdoor.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.leftdoor#rotTime"), 2)*1000;
        self.rotationPartleftdoor.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.leftdoor#touchRotLimit"), 10));
    end;
local rotationPartNoderightwindows = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rightwindows#index"));
    if rotationPartNoderightwindows ~= nil then
        self.rotationPartrightwindows = {};
        self.rotationPartrightwindows.node = rotationPartNoderightwindows;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rightwindows#minRot"));
        self.rotationPartrightwindows.minRot = {};
        self.rotationPartrightwindows.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrightwindows.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrightwindows.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rightwindows#maxRot"));
        self.rotationPartrightwindows.maxRot = {};
        self.rotationPartrightwindows.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrightwindows.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrightwindows.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartrightwindows.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rightwindows#rotTime"), 2)*1000;
        self.rotationPartrightwindows.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rightwindows#touchRotLimit"), 10));
    end;
local rotationPartNodeleftwindows = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.leftwindows#index"));
    if rotationPartNodeleftwindows ~= nil then
        self.rotationPartleftwindows = {};
        self.rotationPartleftwindows.node = rotationPartNodeleftwindows;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.leftwindows#minRot"));
        self.rotationPartleftwindows.minRot = {};
        self.rotationPartleftwindows.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartleftwindows.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartleftwindows.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.leftwindows#maxRot"));
        self.rotationPartleftwindows.maxRot = {};
        self.rotationPartleftwindows.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartleftwindows.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartleftwindows.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartleftwindows.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.leftwindows#rotTime"), 2)*1000;
        self.rotationPartleftwindows.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.leftwindows#touchRotLimit"), 10));
    end;
local rotationPartNodelyuk = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.lyuk#index"));
    if rotationPartNodelyuk ~= nil then
        self.rotationPartlyuk = {};
        self.rotationPartlyuk.node = rotationPartNodelyuk;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.lyuk#minRot"));
        self.rotationPartlyuk.minRot = {};
        self.rotationPartlyuk.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartlyuk.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartlyuk.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.lyuk#maxRot"));
        self.rotationPartlyuk.maxRot = {};
        self.rotationPartlyuk.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartlyuk.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartlyuk.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartlyuk.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.lyuk#rotTime"), 2)*1000;
        self.rotationPartlyuk.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.lyuk#touchRotLimit"), 10));
    end;
local rotationPartNodemufta = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.mufta#index"));
    if rotationPartNodemufta ~= nil then
        self.rotationPartmufta = {};
        self.rotationPartmufta.node = rotationPartNodemufta;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.mufta#minRot"));
        self.rotationPartmufta.minRot = {};
        self.rotationPartmufta.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartmufta.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartmufta.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.mufta#maxRot"));
        self.rotationPartmufta.maxRot = {};
        self.rotationPartmufta.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartmufta.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartmufta.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartmufta.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.mufta#rotTime"), 2)*1000;
        self.rotationPartmufta.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.mufta#touchRotLimit"), 10));
    end;
local rotationPartNodetum = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.tum#index"));
    if rotationPartNodetum ~= nil then
        self.rotationParttum = {};
        self.rotationParttum.node = rotationPartNodetum;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tum#minRot"));
        self.rotationParttum.minRot = {};
        self.rotationParttum.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttum.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttum.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tum#maxRot"));
        self.rotationParttum.maxRot = {};
        self.rotationParttum.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttum.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttum.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationParttum.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.tum#rotTime"), 2)*1000;
        self.rotationParttum.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.tum#touchRotLimit"), 10));
    end;
local rotationPartNodetumb = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.tumb#index"));
    if rotationPartNodetumb ~= nil then
        self.rotationParttumb = {};
        self.rotationParttumb.node = rotationPartNodetumb;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumb#minRot"));
        self.rotationParttumb.minRot = {};
        self.rotationParttumb.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumb.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumb.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumb#maxRot"));
        self.rotationParttumb.maxRot = {};
        self.rotationParttumb.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumb.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumb.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationParttumb.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumb#rotTime"), 2)*1000;
        self.rotationParttumb.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumb#touchRotLimit"), 10));
    end;
local rotationPartNodetumbl = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.tumbl#index"));
    if rotationPartNodetumbl ~= nil then
        self.rotationParttumbl = {};
        self.rotationParttumbl.node = rotationPartNodetumbl;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumbl#minRot"));
        self.rotationParttumbl.minRot = {};
        self.rotationParttumbl.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumbl.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumbl.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumbl#maxRot"));
        self.rotationParttumbl.maxRot = {};
        self.rotationParttumbl.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumbl.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumbl.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationParttumbl.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumbl#rotTime"), 2)*1000;
        self.rotationParttumbl.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumbl#touchRotLimit"), 10));
    end;
local rotationPartNodetumble = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.tumble#index"));
    if rotationPartNodetumble ~= nil then
        self.rotationParttumble = {};
        self.rotationParttumble.node = rotationPartNodetumble;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumble#minRot"));
        self.rotationParttumble.minRot = {};
        self.rotationParttumble.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumble.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumble.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumble#maxRot"));
        self.rotationParttumble.maxRot = {};
        self.rotationParttumble.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumble.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumble.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationParttumble.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumble#rotTime"), 2)*1000;
        self.rotationParttumble.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumble#touchRotLimit"), 10));
    end;
local rotationPartNodetumbler = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.tumbler#index"));
    if rotationPartNodetumbler ~= nil then
        self.rotationParttumbler = {};
        self.rotationParttumbler.node = rotationPartNodetumbler;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumbler#minRot"));
        self.rotationParttumbler.minRot = {};
        self.rotationParttumbler.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumbler.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumbler.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.tumbler#maxRot"));
        self.rotationParttumbler.maxRot = {};
        self.rotationParttumbler.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationParttumbler.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationParttumbler.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationParttumbler.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumbler#rotTime"), 2)*1000;
        self.rotationParttumbler.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.tumbler#touchRotLimit"), 10));
    end;
local rotationPartNoderuchnjak = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.ruchnjak#index"));
    if rotationPartNoderuchnjak ~= nil then
        self.rotationPartruchnjak = {};
        self.rotationPartruchnjak.node = rotationPartNoderuchnjak;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.ruchnjak#minRot"));
        self.rotationPartruchnjak.minRot = {};
        self.rotationPartruchnjak.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartruchnjak.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartruchnjak.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.ruchnjak#maxRot"));
        self.rotationPartruchnjak.maxRot = {};
        self.rotationPartruchnjak.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartruchnjak.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartruchnjak.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartruchnjak.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.ruchnjak#rotTime"), 2)*1000;
        self.rotationPartruchnjak.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.ruchnjak#touchRotLimit"), 10));
    end;
        local translationHookNode = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationHook#index"));
    if translationHookNode ~= nil then
        self.translationHook = {};
        self.translationHook.node = translationHookNode;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationHook#minTrans"));
        self.translationHook.minTrans = {};
        self.translationHook.minTrans[1] = Utils.getNoNil(x, 0);
        self.translationHook.minTrans[2] = Utils.getNoNil(y, 0);
        self.translationHook.minTrans[3] = Utils.getNoNil(z, 0);

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationHook#maxTrans"));
        self.translationHook.maxTrans = {};
        self.translationHook.maxTrans[1] = Utils.getNoNil(x, 0);
        self.translationHook.maxTrans[2] = Utils.getNoNil(y, 0);
        self.translationHook.maxTrans[3] = Utils.getNoNil(z, 0);

        self.translationHook.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationHook#transTime"), 2)*1000;
        self.translationHook.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationHook#touchTransLimit"), 10);
    end;   
        local translationHook2Node = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.translationHook2#index"));
    if translationHook2Node ~= nil then
        self.translationHook2 = {};
        self.translationHook2.node = translationHook2Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationHook2#minTrans"));
        self.translationHook2.minTrans = {};
        self.translationHook2.minTrans[1] = Utils.getNoNil(x, 0);
        self.translationHook2.minTrans[2] = Utils.getNoNil(y, 0);
        self.translationHook2.minTrans[3] = Utils.getNoNil(z, 0);

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationHook2#maxTrans"));
        self.translationHook2.maxTrans = {};
        self.translationHook2.maxTrans[1] = Utils.getNoNil(x, 0);
        self.translationHook2.maxTrans[2] = Utils.getNoNil(y, 0);
        self.translationHook2.maxTrans[3] = Utils.getNoNil(z, 0);

        self.translationHook2.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationHook2#transTime"), 2)*1000;
        self.translationHook2.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationHook2#touchTransLimit"), 10);
    end;      

--[[stop]]------------------------------------------------------------
local rotationPartNodebrakerihag = Utils.indexToObject(self.rootNode, getXMLString(xmlFile, "vehicle.rotationPartbrakerihag#index"));
    if rotationPartNodebrakerihag ~= nil then
        self.rotationPartbrakerihag = {};
        self.rotationPartbrakerihag.node = rotationPartNodebrakerihag;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartbrakerihag#minRot"));
        self.rotationPartbrakerihag.minRot = {};
        self.rotationPartbrakerihag.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartbrakerihag.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartbrakerihag.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartbrakerihag#maxRot"));
        self.rotationPartbrakerihag.maxRot = {};
        self.rotationPartbrakerihag.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartbrakerihag.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartbrakerihag.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartbrakerihag.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartbrakerihag#rotTime"), 2)*1000;
        self.rotationPartbrakerihag.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartbrakerihag#touchRotLimit"), 10));
    end;

	handbrakeSoundFile = Utils.getFilename("sounds/handbrake.wav", self.baseDirectory);
	self.handbrakeSoundId = createSample("handbrakeSound");
	loadSample(self.handbrakeSoundId, handbrakeSoundFile, false);






--[[panel]]------------------------------------------------------------
	self.numkablights = Utils.getNoNil(getXMLInt(xmlFile, "vehicle.kablights#count"), 0);
    self.kablights = {};
    for i=1, self.numkablights do
        local kablightsnamei = string.format("vehicle.kablights.kablights" .. "%d", i);
        self.kablights[i] = Utils.indexToObject(self.rootNode, getXMLInt(xmlFile, kablightsnamei .. "#index"));
        setVisibility(self.kablights[i], false);
    end;	
     self.kablightsActive = false;


--[[rul]]------------------------------------------------------------
	self.numFrontlights = Utils.getNoNil(getXMLInt(xmlFile, "vehicle.frontlights#count"), 0);
    self.frontlights = {};
    for i=1, self.numFrontlights do
        local frontlightnamei = string.format("vehicle.frontlights.frontlight" .. "%d", i);
        self.frontlights[i] = Utils.indexToObject(self.rootNode, getXMLInt(xmlFile, frontlightnamei .. "#index"));
        setVisibility(self.frontlights[i], false);
    end;	
     self.frontlightsActive = false;


--[[val]]------------------------------------------------------------
self.crankshaftNode = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft#index"));
self.crankshaft1Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft1#index"));
self.crankshaft2Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft2#index"));
self.crankshaft3Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft3#index"));
self.crankshaft4Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft4#index"));
self.crankshaft5Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft5#index"));
self.crankshaft6Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft6#index"));
self.crankshaft7Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft7#index"));
self.crankshaft8Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft8#index"));
self.crankshaft9Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft9#index"));
self.crankshaft10Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft10#index"));
self.crankshaft11Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft11#index"));
self.crankshaft12Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.crankshaft12#index"));







local rotationPartNodekorobka0 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobka0#index"));
    if rotationPartNodekorobka0 ~= nil then
        self.rotationPartkorobka0 = {};
        self.rotationPartkorobka0.node = rotationPartNodekorobka0;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobka0#minRot"));
        self.rotationPartkorobka0.minRot = {};
        self.rotationPartkorobka0.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka0.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka0.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobka0#maxRot"));
        self.rotationPartkorobka0.maxRot = {};
        self.rotationPartkorobka0.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka0.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka0.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobka0.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka0#rotTime"), 2)*1000;
        self.rotationPartkorobka0.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka0#touchRotLimit"), 10));
    end;
 local rotationPartNodekorobka = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobka#index"));
    if rotationPartNodekorobka ~= nil then
        self.rotationPartkorobka = {};
        self.rotationPartkorobka.node = rotationPartNodekorobka;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobka#minRot"));
        self.rotationPartkorobka.minRot = {};
        self.rotationPartkorobka.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobka#maxRot"));
        self.rotationPartkorobka.maxRot = {};
        self.rotationPartkorobka.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobka.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka#rotTime"), 2)*1000;
        self.rotationPartkorobka.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka#touchRotLimit"), 10));
    end;
	local rotationPartNodekorobka1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobka1#index"));
    if rotationPartNodekorobka1 ~= nil then
        self.rotationPartkorobka1 = {};
        self.rotationPartkorobka1.node = rotationPartNodekorobka1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobka1#minRot"));
        self.rotationPartkorobka1.minRot = {};
        self.rotationPartkorobka1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobka1#maxRot"));
        self.rotationPartkorobka1.maxRot = {};
        self.rotationPartkorobka1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobka1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka1#rotTime"), 2)*1000;
        self.rotationPartkorobka1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka1#touchRotLimit"), 10));
    end;
	local rotationPartNodekorobka2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobka2#index"));
    if rotationPartNodekorobka2 ~= nil then
        self.rotationPartkorobka2 = {};
        self.rotationPartkorobka2.node = rotationPartNodekorobka2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobka2#minRot"));
        self.rotationPartkorobka2.minRot = {};
        self.rotationPartkorobka2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobka2#maxRot"));
        self.rotationPartkorobka2.maxRot = {};
        self.rotationPartkorobka2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobka2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka2#rotTime"), 2)*1000;
        self.rotationPartkorobka2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka2#touchRotLimit"), 10));
    end;	
local rotationPartNodekorobka3 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobka3#index"));
    if rotationPartNodekorobka3 ~= nil then
        self.rotationPartkorobka3 = {};
        self.rotationPartkorobka3.node = rotationPartNodekorobka3;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobka3#minRot"));
        self.rotationPartkorobka3.minRot = {};
        self.rotationPartkorobka3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobka3#maxRot"));
        self.rotationPartkorobka3.maxRot = {};
        self.rotationPartkorobka3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobka3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka3#rotTime"), 2)*1000;
        self.rotationPartkorobka3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka3#touchRotLimit"), 10));
    end;		
	local rotationPartNodekorobka4 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobka4#index"));
    if rotationPartNodekorobka4 ~= nil then
        self.rotationPartkorobka4 = {};
        self.rotationPartkorobka4.node = rotationPartNodekorobka4;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobka4#minRot"));
        self.rotationPartkorobka4.minRot = {};
        self.rotationPartkorobka4.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka4.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka4.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobka4#maxRot"));
        self.rotationPartkorobka4.maxRot = {};
        self.rotationPartkorobka4.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobka4.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobka4.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobka4.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka4#rotTime"), 2)*1000;
        self.rotationPartkorobka4.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobka4#touchRotLimit"), 10));
    end;
	local rotationPartNodekorobkazad = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.korobkazad#index"));
    if rotationPartNodekorobkazad ~= nil then
        self.rotationPartkorobkazad = {};
        self.rotationPartkorobkazad.node = rotationPartNodekorobkazad;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartkorobkazad#minRot"));
        self.rotationPartkorobkazad.minRot = {};
        self.rotationPartkorobkazad.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobkazad.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobkazad.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.korobkazad#maxRot"));
        self.rotationPartkorobkazad.maxRot = {};
        self.rotationPartkorobkazad.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartkorobkazad.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartkorobkazad.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartkorobkazad.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobkazad#rotTime"), 2)*1000;
        self.rotationPartkorobkazad.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.korobkazad#touchRotLimit"), 10));
    end;












local rotationPartNoderu4ka1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartru4ka1#index"));
      if rotationPartNoderu4ka1 ~= nil then
        self.rotationPartru4ka1 = {};
        self.rotationPartru4ka1.node = rotationPartNoderu4ka1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#minRot"));
        self.rotationPartru4ka1.minRot = {};
        self.rotationPartru4ka1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#maxRot"));
        self.rotationPartru4ka1.maxRot = {};
        self.rotationPartru4ka1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartru4ka1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#rotTime"), 2)*1000;
        self.rotationPartru4ka1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#touchRotLimit"), 10));
    end;

local rotationPartNoderu4ka2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartru4ka2#index"));
      if rotationPartNoderu4ka2 ~= nil then
        self.rotationPartru4ka2 = {};
        self.rotationPartru4ka2.node = rotationPartNoderu4ka2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#minRot"));
        self.rotationPartru4ka2.minRot = {};
        self.rotationPartru4ka2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#maxRot"));
        self.rotationPartru4ka2.maxRot = {};
        self.rotationPartru4ka2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartru4ka2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#rotTime"), 2)*1000;
        self.rotationPartru4ka2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#touchRotLimit"), 10));
    end;



    self.wiper1Active = false;	
    self.wiper2Active = false;
    self.wiper3Active = false;	
    self.wiper4Active = false;
    self.wiper5Active = false;	
    self.wiper6Active = false;	
    self.delayOnLeft = 0;
    self.delayOffLeft = 0;
    self.delayOnRight = 0;
    self.delayOffRight = 0;
    self.delayWischer1 = 0;
    self.delayWischer2 = 0;
    self.delayOn = 0;
    self.delayOff = 0;
    self.deltafo = 0;

  local wiper1Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper1#index"));
    if wiper1Node ~= nil then
        self.wiper1 = {};
        self.wiper1.node = wiper1Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper1#minRot"));
        self.wiper1.minRot = {};
        self.wiper1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper1#maxRot"));
        self.wiper1.maxRot = {};
        self.wiper1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper1#rotTime"), 2)*1000;
        self.wiper1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper1#touchRotLimit"), 10));
    end;
	
	local wiper2Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper2#index"));
    if wiper2Node ~= nil then
        self.wiper2 = {};
        self.wiper2.node = wiper2Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper2#minRot"));
        self.wiper2.minRot = {};
        self.wiper2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper2#maxRot"));
        self.wiper2.maxRot = {};
        self.wiper2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper2#rotTime"), 2)*1000;
        self.wiper2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper2#touchRotLimit"), 10));
    end;


  local wiper3Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper3#index"));
    if wiper3Node ~= nil then
        self.wiper3 = {};
        self.wiper3.node = wiper3Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper3#minRot"));
        self.wiper3.minRot = {};
        self.wiper3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper3#maxRot"));
        self.wiper3.maxRot = {};
        self.wiper3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper3#rotTime"), 2)*1000;
        self.wiper3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper3#touchRotLimit"), 10));
    end;
	
	local wiper4Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper4#index"));
    if wiper4Node ~= nil then
        self.wiper4 = {};
        self.wiper4.node = wiper4Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper4#minRot"));
        self.wiper4.minRot = {};
        self.wiper4.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper4.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper4.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper4#maxRot"));
        self.wiper4.maxRot = {};
        self.wiper4.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper4.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper4.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper4.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper4#rotTime"), 2)*1000;
        self.wiper4.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper4#touchRotLimit"), 10));
    end;

  local wiper5Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper5#index"));
    if wiper5Node ~= nil then
        self.wiper5 = {};
        self.wiper5.node = wiper5Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper5#minRot"));
        self.wiper5.minRot = {};
        self.wiper5.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper5.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper5.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper5#maxRot"));
        self.wiper5.maxRot = {};
        self.wiper5.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper5.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper5.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper5.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper5#rotTime"), 2)*1000;
        self.wiper5.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper5#touchRotLimit"), 10));
    end;
	
	local wiper6Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper6#index"));
    if wiper6Node ~= nil then
        self.wiper6 = {};
        self.wiper6.node = wiper6Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper6#minRot"));
        self.wiper6.minRot = {};
        self.wiper6.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper6.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper6.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper6#maxRot"));
        self.wiper6.maxRot = {};
        self.wiper6.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper6.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper6.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper6.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper6#rotTime"), 2)*1000;
        self.wiper6.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper6#touchRotLimit"), 10));
    end;





self.wentelatorNode1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wentelator#index"));
	self.wentelatorRotationScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.wentelator#rotationScale"), 1);
	self.isTurnedOn = false;

self.wentelator1Node1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wentelator1#index"));
	self.wentelator1RotationScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.wentelator1#rotationScale"), 1);
	self.isTurnedOn1 = false;

self.wentelator2Node1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wentelator2#index"));
	self.wentelator2RotationScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.wentelator2#rotationScale"), 1);
	self.isTurnedOn2 = false;

self.wentelator3Node1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wentelator3#index"));
	self.wentelator3RotationScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.wentelator3#rotationScale"), 1);
	self.isTurnedOn3 = false;





    self.motor1Active = false;
    self.motor2Active = false;	
    self.motor3Active = false;		
    self.delayOnLeft = 0;
    self.delayOffLeft = 0;
    self.delayOnRight = 0;
    self.delayOffRight = 0;
    self.delayKurs1 = 0;
    self.delayKurs2 = 0;
    self.delayOn = 0;
    self.delayOff = 0;
    self.deltafo = 0;

  local motor1Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.motor1#index"));
    if motor1Node ~= nil then
        self.motor1 = {};
        self.motor1.node = motor1Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.motor1#minRot"));
        self.motor1.minRot = {};
        self.motor1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.motor1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.motor1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.motor1#maxRot"));
        self.motor1.maxRot = {};
        self.motor1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.motor1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.motor1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.motor1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.motor1#rotTime"), 2)*70;
        self.motor1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.motor1#touchRotLimit"), 10));
    end;

  local motor2Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.motor2#index"));
    if motor2Node ~= nil then
        self.motor2 = {};
        self.motor2.node = motor2Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.motor2#minRot"));
        self.motor2.minRot = {};
        self.motor2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.motor2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.motor2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.motor2#maxRot"));
        self.motor2.maxRot = {};
        self.motor2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.motor2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.motor2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.motor2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.motor2#rotTime"), 2)*70;
        self.motor2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.motor2#touchRotLimit"), 10));
    end;

  local motor3Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.motor3#index"));
    if motor3Node ~= nil then
        self.motor3 = {};
        self.motor3.node = motor3Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.motor3#minRot"));
        self.motor3.minRot = {};
        self.motor3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.motor3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.motor3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.motor3#maxRot"));
        self.motor3.maxRot = {};
        self.motor3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.motor3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.motor3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.motor3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.motor3#rotTime"), 2)*70;
        self.motor3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.motor3#touchRotLimit"), 10));
    end;





local rotationPartNodepoworotnika = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnika#index"));
    if rotationPartNodepoworotnika ~= nil then
        self.rotationPartpoworotnika = {};
        self.rotationPartpoworotnika.node = rotationPartNodepoworotnika;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnika#minRot"));
        self.rotationPartpoworotnika.minRot = {};
        self.rotationPartpoworotnika.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnika.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnika.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnika#maxRot"));
        self.rotationPartpoworotnika.maxRot = {};
        self.rotationPartpoworotnika.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnika.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnika.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnika.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnika#rotTime"), 2)*1000;
        self.rotationPartpoworotnika.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnika#touchRotLimit"), 10));
    end;

local rotationPartNodepoworotnikk = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnikk#index"));
    if rotationPartNodepoworotnikk ~= nil then
        self.rotationPartpoworotnikk = {};
        self.rotationPartpoworotnikk.node = rotationPartNodepoworotnikk;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnikk#minRot"));
        self.rotationPartpoworotnikk.minRot = {};
        self.rotationPartpoworotnikk.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnikk.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnikk.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnikk#maxRot"));
        self.rotationPartpoworotnikk.maxRot = {};
        self.rotationPartpoworotnikk.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnikk.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnikk.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnikk.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnikk#rotTime"), 2)*1000;
        self.rotationPartpoworotnikk.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnikk#touchRotLimit"), 10));
    end;

local rotationPartNodepoworotnik = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnik#index"));
    if rotationPartNodepoworotnik ~= nil then
        self.rotationPartpoworotnik = {};
        self.rotationPartpoworotnik.node = rotationPartNodepoworotnik;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnik#minRot"));
        self.rotationPartpoworotnik.minRot = {};
        self.rotationPartpoworotnik.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnik#maxRot"));
        self.rotationPartpoworotnik.maxRot = {};
        self.rotationPartpoworotnik.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnik.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik#rotTime"), 2)*1000;
        self.rotationPartpoworotnik.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik#touchRotLimit"), 10));
    end;
local rotationPartNodepoworotnik0 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnik0#index"));
    if rotationPartNodepoworotnik0 ~= nil then
        self.rotationPartpoworotnik0 = {};
        self.rotationPartpoworotnik0.node = rotationPartNodepoworotnik0;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnik0#minRot"));
        self.rotationPartpoworotnik0.minRot = {};
        self.rotationPartpoworotnik0.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik0.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik0.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnik0#maxRot"));
        self.rotationPartpoworotnik0.maxRot = {};
        self.rotationPartpoworotnik0.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik0.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik0.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnik0.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik0#rotTime"), 2)*1000;
        self.rotationPartpoworotnik0.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik0#touchRotLimit"), 10));
    end;








	local rotationPartNoderichag1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartrichag1#index"));
    if rotationPartNoderichag1 ~= nil then
        self.rotationPartrichag1 = {};
        self.rotationPartrichag1.node = rotationPartNoderichag1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag1#minRot"));
        self.rotationPartrichag1.minRot = {};
        self.rotationPartrichag1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag1#maxRot"));
        self.rotationPartrichag1.maxRot = {};
        self.rotationPartrichag1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartrichag1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag1#rotTime"), 2)*1000;
        self.rotationPartrichag1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag1#touchRotLimit"), 10));
    end;

	local rotationPartNoderichag2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartrichag2#index"));
    if rotationPartNoderichag2 ~= nil then
        self.rotationPartrichag2 = {};
        self.rotationPartrichag2.node = rotationPartNoderichag2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag2#minRot"));
        self.rotationPartrichag2.minRot = {};
        self.rotationPartrichag2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag2#maxRot"));
        self.rotationPartrichag2.maxRot = {};
        self.rotationPartrichag2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartrichag2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag2#rotTime"), 2)*1000;
        self.rotationPartrichag2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag2#touchRotLimit"), 10));
    end;

	local rotationPartNoderichag3 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartrichag3#index"));
    if rotationPartNoderichag3 ~= nil then
        self.rotationPartrichag3 = {};
        self.rotationPartrichag3.node = rotationPartNoderichag3;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag3#minRot"));
        self.rotationPartrichag3.minRot = {};
        self.rotationPartrichag3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag3#maxRot"));
        self.rotationPartrichag3.maxRot = {};
        self.rotationPartrichag3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartrichag3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag3#rotTime"), 2)*1000;
        self.rotationPartrichag3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag3#touchRotLimit"), 10));
    end;

	local rotationPartNoderichag4 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartrichag4#index"));
    if rotationPartNoderichag4 ~= nil then
        self.rotationPartrichag4 = {};
        self.rotationPartrichag4.node = rotationPartNoderichag4;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag4#minRot"));
        self.rotationPartrichag4.minRot = {};
        self.rotationPartrichag4.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag4.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag4.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartrichag4#maxRot"));
        self.rotationPartrichag4.maxRot = {};
        self.rotationPartrichag4.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartrichag4.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartrichag4.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartrichag4.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag4#rotTime"), 2)*1000;
        self.rotationPartrichag4.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartrichag4#touchRotLimit"), 10));
    end;

	local rotationPartNodePedal3 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedal3#index"));
    if rotationPartNodePedal3 ~= nil then
        self.rotationPartPedal3 = {};
        self.rotationPartPedal3.node = rotationPartNodePedal3;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal3#minRot"));
        self.rotationPartPedal3.minRot = {};
        self.rotationPartPedal3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal3#maxRot"));
        self.rotationPartPedal3.maxRot = {};
        self.rotationPartPedal3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedal3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal3#rotTime"), 2)*1000;
        self.rotationPartPedal3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal3#touchRotLimit"), 10));
    end;

	local rotationPartNodePedal2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedal2#index"));
    if rotationPartNodePedal2 ~= nil then
        self.rotationPartPedal2 = {};
        self.rotationPartPedal2.node = rotationPartNodePedal2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal2#minRot"));
        self.rotationPartPedal2.minRot = {};
        self.rotationPartPedal2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal2#maxRot"));
        self.rotationPartPedal2.maxRot = {};
        self.rotationPartPedal2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedal2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal2#rotTime"), 2)*1000;
        self.rotationPartPedal2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal2#touchRotLimit"), 10));
    end;

	local rotationPartNodePedalr = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedalr#index"));
    if rotationPartNodePedalr ~= nil then
        self.rotationPartPedalr = {};
        self.rotationPartPedalr.node = rotationPartNodePedalr;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedalr#minRot"));
        self.rotationPartPedalr.minRot = {};
        self.rotationPartPedalr.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedalr.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedalr.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedalr#maxRot"));
        self.rotationPartPedalr.maxRot = {};
        self.rotationPartPedalr.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedalr.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedalr.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedalr.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedalr#rotTime"), 2)*1000;
        self.rotationPartPedalr.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedalr#touchRotLimit"), 10));
    end;

local rotationPartNodeDrehzahl1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#index"));
    if rotationPartNodeDrehzahl1 ~= nil then
        self.rotationPartDrehzahl1 = {};
        self.rotationPartDrehzahl1.node = rotationPartNodeDrehzahl1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#minRot"));
        self.rotationPartDrehzahl1.minRot = {};
        self.rotationPartDrehzahl1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#maxRot"));
        self.rotationPartDrehzahl1.maxRot = {};
        self.rotationPartDrehzahl1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartDrehzahl1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#rotTime"), 2)*1000;
        self.rotationPartDrehzahl1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#touchRotLimit"), 10));
    end;
	
	local rotationPartNodeDrehzahl2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#index"));
    if rotationPartNodeDrehzahl2 ~= nil then
        self.rotationPartDrehzahl2 = {};
        self.rotationPartDrehzahl2.node = rotationPartNodeDrehzahl2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#minRot"));
        self.rotationPartDrehzahl2.minRot = {};
        self.rotationPartDrehzahl2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#maxRot"));
        self.rotationPartDrehzahl2.maxRot = {};
        self.rotationPartDrehzahl2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartDrehzahl2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#rotTime"), 2)*1000;
        self.rotationPartDrehzahl2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#touchRotLimit"), 10));
    end;





      self.tanklight = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tanklight#index"));
	self.tank2light = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tanklight#index2"));
      self.tanklightActive = false;

local rotationPartNodeTanknadel = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartTanknadel#index"));
    if rotationPartNodeTanknadel ~= nil then
        self.rotationPartTanknadel = {};
        self.rotationPartTanknadel.node = rotationPartNodeTanknadel;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#minRot"));
        self.rotationPartTanknadel.minRot = {};
        self.rotationPartTanknadel.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#maxRot"));
        self.rotationPartTanknadel.maxRot = {};
        self.rotationPartTanknadel.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartTanknadel.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#rotTime"), 2)*1000;
        self.rotationPartTanknadel.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#touchRotLimit"), 10));
    end;
	
	local rotationPartNodeTanknadel2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#index"));
    if rotationPartNodeTanknadel2 ~= nil then
        self.rotationPartTanknadel2 = {};
        self.rotationPartTanknadel2.node = rotationPartNodeTanknadel2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#minRot"));
        self.rotationPartTanknadel2.minRot = {};
        self.rotationPartTanknadel2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#maxRot"));
        self.rotationPartTanknadel2.maxRot = {};
        self.rotationPartTanknadel2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartTanknadel2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#rotTime"), 2)*1000;
        self.rotationPartTanknadel2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#touchRotLimit"), 10));
    end;

    fuelwarningSoundFile = Utils.getFilename("sounds/fuelwarning.wav", self.baseDirectory);
    self.fuelwarningSoundId = createSample("fuelwarningSound");
    loadSample(self.fuelwarningSoundId, fuelwarningSoundFile, false);
    self.fuelwarningPlaying = false;







	local rotationPartNodePedal = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedal#index"));
    if rotationPartNodePedal ~= nil then
        self.rotationPartPedal = {};
        self.rotationPartPedal.node = rotationPartNodePedal;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal#minRot"));
        self.rotationPartPedal.minRot = {};
        self.rotationPartPedal.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal#maxRot"));
        self.rotationPartPedal.maxRot = {};
        self.rotationPartPedal.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedal.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal#rotTime"), 2)*1000;
        self.rotationPartPedal.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal#touchRotLimit"), 10));
    end;

local rotationPartNodeKmh1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartKmh1#index"));
    if rotationPartNodeKmh1 ~= nil then
        self.rotationPartKmh1 = {};
        self.rotationPartKmh1.node = rotationPartNodeKmh1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh1#minRot"));
        self.rotationPartKmh1.minRot = {};
        self.rotationPartKmh1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh1#maxRot"));
        self.rotationPartKmh1.maxRot = {};
        self.rotationPartKmh1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartKmh1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh1#rotTime"), 2)*1000;
        self.rotationPartKmh1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh1#touchRotLimit"), 10));
    end;
	
	local rotationPartNodeKmh2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartKmh2#index"));
    if rotationPartNodeKmh2 ~= nil then
        self.rotationPartKmh2 = {};
        self.rotationPartKmh2.node = rotationPartNodeKmh2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh2#minRot"));
        self.rotationPartKmh2.minRot = {};
        self.rotationPartKmh2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh2#maxRot"));
        self.rotationPartKmh2.maxRot = {};
        self.rotationPartKmh2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartKmh2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh2#rotTime"), 2)*1000;
        self.rotationPartKmh2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh2#touchRotLimit"), 10));
    end;

local rotationPartNodeBrake = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartBrake#index"));
    if rotationPartNodeBrake ~= nil then
        self.rotationPartBrake = {};
        self.rotationPartBrake.node = rotationPartNodeBrake;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartBrake#minRot"));
        self.rotationPartBrake.minRot = {};
        self.rotationPartBrake.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartBrake.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartBrake.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartBrake#maxRot"));
        self.rotationPartBrake.maxRot = {};
        self.rotationPartBrake.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartBrake.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartBrake.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartBrake.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartBrake#rotTime"), 2)*1000;
        self.rotationPartBrake.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartBrake#touchRotLimit"), 10));
    end;

	local translationPartNode = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.translationPart#index"));
    if translationPartNode ~= nil then
        self.translationPart = {};
        self.translationPart.node = translationPartNode;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart#minTrans"));
        self.translationPart.minTrans = {};
        self.translationPart.minTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart.minTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart.minTrans[3] = Utils.getNoNil(z, 0);

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart#maxTrans"));
        self.translationPart.maxTrans = {};
        self.translationPart.maxTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart.maxTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart.maxTrans[3] = Utils.getNoNil(z, 0);

        self.translationPart.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart#transTime"), 2)*1000;
        self.translationPart.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart#touchTransLimit"), 10);
    end;
    local translationPartNode2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.translationPart2#index"));
    if translationPartNode2 ~= nil then
        self.translationPart2 = {};
        self.translationPart2.node = translationPartNode2;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart2#minTrans"));
        self.translationPart2.minTrans = {};
        self.translationPart2.minTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart2.minTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart2.minTrans[3] = Utils.getNoNil(z, 0);

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart2#maxTrans"));
        self.translationPart2.maxTrans = {};
        self.translationPart2.maxTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart2.maxTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart2.maxTrans[3] = Utils.getNoNil(z, 0);

        self.translationPart2.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart2#transTime"), 2)*1000;
        self.translationPart2.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart2#touchTransLimit"), 10);
    end; 

	local rotationNode6 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation6#index"));
    if rotationNode6 ~= nil then
        self.rotation6 = {};
        self.rotation6.node = rotationNode6;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation6#minRot"));
        self.rotation6.minRot = {};
        self.rotation6.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation6.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation6.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation6#maxRot"));
        self.rotation6.maxRot = {};
        self.rotation6.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation6.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation6.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation6.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation6#rotTime"), 2)*1000;
        self.rotation6.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation6#touchRotLimit"), 10));
    end; 

	local rotationNode7 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation7#index"));
    if rotationNode7 ~= nil then
        self.rotation7 = {};
        self.rotation7.node = rotationNode7;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation7#minRot"));
        self.rotation7.minRot = {};
        self.rotation7.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation7.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation7.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation7#maxRot"));
        self.rotation7.maxRot = {};
        self.rotation7.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation7.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation7.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation7.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation7#rotTime"), 2)*1000;
        self.rotation7.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation7#touchRotLimit"), 10));
    end;       
	
	local rotationNode8 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation8#index"));
    if rotationNode8 ~= nil then
        self.rotation8 = {};
        self.rotation8.node = rotationNode8;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation8#minRot"));
        self.rotation8.minRot = {};
        self.rotation8.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation8.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation8.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation8#maxRot"));
        self.rotation8.maxRot = {};
        self.rotation8.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation8.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation8.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation8.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation8#rotTime"), 2)*1000;
        self.rotation8.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation8#touchRotLimit"), 10));
    end;
	
	local rotationNode9 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation9#index"));
    if rotationNode9 ~= nil then
        self.rotation9 = {};
        self.rotation9.node = rotationNode9;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation9#minRot"));
        self.rotation9.minRot = {};
        self.rotation9.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation9.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation9.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation9#maxRot"));
        self.rotation9.maxRot = {};
        self.rotation9.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation9.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation9.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation9.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation9#rotTime"), 2)*1000;
        self.rotation9.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation9#touchRotLimit"), 10));
    end;

    local rotationPartNodeLeft11 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartLeft11#index"));
    if rotationPartNodeLeft11 ~= nil then
        self.rotationPartLeft11 = {};
        self.rotationPartLeft11.node = rotationPartNodeLeft11;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartLeft11#minRot"));
        self.rotationPartLeft11.minRot = {};
        self.rotationPartLeft11.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartLeft11.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartLeft11.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartLeft11#maxRot"));
        self.rotationPartLeft11.maxRot = {};
        self.rotationPartLeft11.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartLeft11.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartLeft11.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.rotationPartLeft11.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartLeft11#rotTime"), 2)*1000;
        self.rotationPartLeft11.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartLeft11#touchRotLimit"), 10));
    end;



end;



















      
function Teleskopladerser:delete()    
end;


function Teleskopladerser:mouseEvent(posX, posY, isDown, isUp, button)
end;

	  
function Teleskopladerser:keyEvent(unicode, sym, modifier, isDown)

--[[info]]------------------------------------------------------------
 if isDown and sym == Input.KEY_9 then
		self.helpPanel = not self.helpPanel;
	end;

--[[windows]]------------------------------------------------------------
    if isDown and sym == Input.KEY_KP_6 then 
	self.rotationMaxrightdoor = not self.rotationMaxrightdoor;
	self.rotationMaxrightdoor1 = not self.rotationMaxrightdoor1;
    end;
    if isDown and sym == Input.KEY_KP_4 then 
	self.rotationMaxleftdoor = not self.rotationMaxleftdoor;
	self.rotationMaxleftdoor1 = not self.rotationMaxleftdoor1;
    end;
    if isDown and sym == Input.KEY_KP_9 then 
	self.rotationMaxrightwindows = not self.rotationMaxrightwindows;
	self.rotationMaxrightwindows1 = not self.rotationMaxrightwindows1;
    end;
    if isDown and sym == Input.KEY_KP_7 then 
	self.rotationMaxleftwindows = not self.rotationMaxleftwindows;
	self.rotationMaxleftwindows1 = not self.rotationMaxleftwindows1;
    end;
    if isDown and sym == Input.KEY_KP_5 then 
	self.rotationMaxlyuk = not self.rotationMaxlyuk;
	self.rotationMaxlyuk1 = not self.rotationMaxlyuk1;
    end;
    if isDown and sym == Input.KEY_KP_0 then 
	self.rotationMaxmufta = not self.rotationMaxmufta;
	self.rotationMaxmufta1 = not self.rotationMaxmufta1;
    end;
    if isDown and sym == Input.KEY_f then 
	self.rotationMaxtum = not self.rotationMaxtum;
	self.rotationMaxtum1 = not self.rotationMaxtum1;
    end;
    if isDown and sym == Input.KEY_l then 
	self.rotationMaxtumb = not self.rotationMaxtumb;
	self.rotationMaxtumb1 = not self.rotationMaxtumb1;
    end;
    if isDown and sym == Input.KEY_j then 
	self.rotationMaxtumbl = not self.rotationMaxtumbl;
	self.rotationMaxtumbl1 = not self.rotationMaxtumbl1;
    end;
    if isDown and sym == Input.KEY_y then 
	self.rotationMaxtumble = not self.rotationMaxtumble;
	self.rotationMaxtumble1 = not self.rotationMaxtumble1;
    end;
    if isDown and sym == Input.KEY_KP_multiply then 
	self.rotationMaxtumbler = not self.rotationMaxtumbler;
	self.rotationMaxtumbler1 = not self.rotationMaxtumbler1;
    end;
    if isDown and sym == Input.KEY_space then 
	self.rotationMaxruchnjak = not self.rotationMaxruchnjak;
	self.rotationMaxruchnjak1 = not self.rotationMaxruchnjak1;
    end;
    if sym == Input.KEY_7 then
		self.translationMin = isDown;
		self.translationHookMin = isDown;
	end;
	if sym == Input.KEY_8 then
		self.translationMax = isDown;
		self.translationHookMax = isDown;
	end;
    if sym == Input.KEY_5 then
		self.translationMin = isDown;
		self.translationHook2Min = isDown;
	end;
	if sym == Input.KEY_KP_7 then
		self.translationMax = isDown;
		self.translationHook2Max = isDown;
	end;

--[[stop]]------------------------------------------------------------	
if isDown and sym == Input.KEY_space then
		self.handbrake = not self.handbrake;
		if self.handbrake then
			playSample(self.handbrakeSoundId,1,1,0);
		end;
	end;

--[[rul]]------------------------------------------------------------
  if isDown and sym == Input.KEY_l then
	    self.frontlightsActive = not self.frontlightsActive;
	  
	end;

--[[panel]]------------------------------------------------------------
  if isDown and sym == Input.KEY_KP_enter then
	    self.kablightsActive = not self.kablightsActive;
	  
	end;











      if self.rotationPartTanknadel ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel.node);
		y = ((self.rotationPartTanknadel.maxRot[2] - self.rotationPartTanknadel.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel.minRot[2];
		setRotation(self.rotationPartTanknadel.node, x, y ,z);
	end;
	
	if self.rotationPartTanknadel2 ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel2.node);
		y = ((self.rotationPartTanknadel2.maxRot[2] - self.rotationPartTanknadel2.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel2.minRot[2];
		setRotation(self.rotationPartTanknadel2.node, x, y ,z);
	end;





      if isDown and sym == Input.KEY_y then 
		self.wiper1Active = not self.wiper1Active;
	  end; 
      if isDown and sym == Input.KEY_y then 
		self.wiper2Active = not self.wiper2Active;
	  end;
      if isDown and sym == Input.KEY_y then 
		self.wiper3Active = not self.wiper3Active;
	  end; 
      if isDown and sym == Input.KEY_y then 
		self.wiper4Active = not self.wiper4Active;
	  end;
      if isDown and sym == Input.KEY_y then 
		self.wiper5Active = not self.wiper5Active;
	  end; 
      if isDown and sym == Input.KEY_y then 
		self.wiper6Active = not self.wiper6Active;
	  end; 

      if isDown and sym == Input.KEY_KP_enter then 
		self.motor1Active = not self.motor1Active;
	  end;

      if isDown and sym == Input.KEY_KP_enter then 
		self.motor2Active = not self.motor2Active;
	  end; 

      if isDown and sym == Input.KEY_KP_enter then 
		self.motor3Active = not self.motor3Active;
	  end; 




     if isDown then
		if sym == Input.KEY_t then
			if self.isTurnedOn == false then
				self.isTurnedOn = true;
			else
				self.isTurnedOn = false;
			end;
		end;		
		
	end;

     if isDown then
		if sym == Input.KEY_t then
			if self.isTurnedOn1 == false then
				self.isTurnedOn1 = true;
			else
				self.isTurnedOn1 = false;
			end;
		end;		
		
	end;

     if isDown then
		if sym == Input.KEY_t then
			if self.isTurnedOn2 == false then
				self.isTurnedOn2 = true;
			else
				self.isTurnedOn2 = false;
			end;
		end;		
		
	end;

     if isDown then
		if sym == Input.KEY_KP_multiply then
			if self.isTurnedOn3 == false then
				self.isTurnedOn3 = true;
			else
				self.isTurnedOn3 = false;
			end;
		end;		
		
	end;


	if sym == Input.KEY_KP_2 then
            self.rotationMaxpoworotnika = not self.rotationMaxpoworotnika;
            self.rotationMaxpoworotnik0 = false;
	
	end;

	if sym == Input.KEY_KP_3 then
            self.rotationMaxpoworotnikk = not self.rotationMaxpoworotnikk;
            self.rotationMaxpoworotnik0 = false;
	
	end;
	
     if sym == Input.KEY_KP_1 then
           self.rotationMaxpoworotnik = not self.rotationMaxpoworotnik;
           self.rotationMaxpoworotnik0 = false;	
	end;	



	
	if self.isEntered then
		if Input.isKeyPressed(Input.KEY_v) then
			self.rotationMaxrichag1 = true;
		else
			self.rotationMaxrichag1 = false;
		end;
		if Input.isKeyPressed(Input.KEY_b) then
			self.rotationMaxrichag2 = true;
		else
			self.rotationMaxrichag2 = false;
		end;
		if Input.isKeyPressed(Input.KEY_x) then
			self.rotationMaxrichag3 = true;
		else
			self.rotationMaxrichag3 = false;
		end;
		if Input.isKeyPressed(Input.KEY_h) then
			self.rotationMaxrichag4 = true;
		else
			self.rotationMaxrichag4 = false;
		end;
		if Input.isKeyPressed(Input.KEY_KP_enter) then
			self.rotationMaxPedal3 = true;
		else
			self.rotationMaxPedal3 = false;
		end;
		if Input.isKeyPressed(Input.KEY_w) then
			self.rotationMaxPedal2 = true;
		else
			self.rotationMaxPedal2 = false;
		end;
		if Input.isKeyPressed(Input.KEY_w) then
			self.rotationMaxPedalr = true;
		else
			self.rotationMaxPedalr = false;
		end;
		if Input.isKeyPressed(Input.KEY_w) then
			self.rotationMaxPedal = true;
		else
			self.rotationMaxPedal = false;
		end;
		if Input.isKeyPressed(Input.KEY_s) then
			self.rotationMaxBrake = true;
		else
			self.rotationMaxBrake = false;
		end;
		if self.gang0 then
			self.rotationMaxClutch = true;
		else
			self.rotationMaxClutch = false;
		end;
	end

	if self.isEntered then
		if Input.isKeyPressed(Input.KEY_v) then
			self.rotationMaxrichag1 = true;
		else
			self.rotationMaxrichag1 = false;
		end;
		if Input.isKeyPressed(Input.KEY_b) then
			self.rotationMaxrichag2 = true;
		else
			self.rotationMaxrichag2 = false;
		end;
		if Input.isKeyPressed(Input.KEY_x) then
			self.rotationMaxrichag3 = true;
		else
			self.rotationMaxrichag3 = false;
		end;
		if Input.isKeyPressed(Input.KEY_h) then
			self.rotationMaxrichag4 = true;
		else
			self.rotationMaxrichag4 = false;
		end;
		if Input.isKeyPressed(Input.KEY_KP_enter) then
			self.rotationMaxPedal3 = true;
		else
			self.rotationMaxPedal3 = false;
		end;
		if Input.isKeyPressed(Input.KEY_w) then
			self.rotationMaxPedal2 = true;
		else
			self.rotationMaxPedal2 = false;
		end;
		if Input.isKeyPressed(Input.KEY_w) then
			self.rotationMaxPedalr = true;
		else
			self.rotationMaxPedalr = false;
		end;
		if Input.isKeyPressed(Input.KEY_w) then
			self.rotationMaxPedal = true;
		else
			self.rotationMaxPedal = false;
		end;
		if Input.isKeyPressed(Input.KEY_s) then
			self.rotationMaxBrake = true;
		else
			self.rotationMaxBrake = false;
		end;
		if self.gang0 then
			self.rotationMaxClutch = true;
		else
			self.rotationMaxClutch = false;
		end;
	end
	


    if sym == Input.KEY_6 then
		self.translationMax = isDown;
	end;
	if sym == Input.KEY_5 then
		self.translationMin = isDown;
	end;

    if sym == Input.KEY_6 then
		self.translationMax2 = isDown;
	end;
	if sym == Input.KEY_5 then
		self.translationMin2 = isDown;
	end;

	if sym == Input.KEY_n then
		self.rotation9Max = isDown;
	end;
	if sym == Input.KEY_m then
		self.rotation9Min = isDown;
	end;
	if sym == Input.KEY_k then
		self.rotation8Max = isDown;
	end;
	if sym == Input.KEY_l then
		self.rotation8Min = isDown;
	end;
	if sym == Input.KEY_h then
		self.rotation7Max = isDown;
	end;
	if sym == Input.KEY_j then
		self.rotation7Min = isDown;
	end;
	if sym == Input.KEY_f then
		self.rotation6Max = isDown;
	end;
	if sym == Input.KEY_g then
		self.rotation6Min = isDown;
	end;



if isDown and sym == Input.KEY_KP_4 then
		if self.chuj then
			self.rotationMaxru4ka1 = true;
		else
			self.rotationMaxru4ka1 = true
		end;
	else
		self.rotationMaxru4ka1 = false;
		end;

if isDown and sym == Input.KEY_KP_6 then
		if self.chuj then
			self.rotationMaxru4ka2 = true;
		else
			self.rotationMaxru4ka2 = true
		end;
	else
		self.rotationMaxru4ka2 = false;
		end;



      if InputBinding.isPressed(InputBinding.SHIT) then
		self.rotationMaxLeft11 = not self.rotationMaxLeft11;
	end;

end;








function Teleskopladerser:update(dt)

		if self.fanNode ~= nil and self.isMotorStarted then 
			 rotate(self.fanNode, 0, 0, self.motor.lastMotorRpm*4);
		end;

--[[windows]]------------------------------------------------------------
        if self.rotationPartrightdoor ~= nil then
		   local x, y, z = getRotation(self.rotationPartrightdoor.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartrightdoor.maxRot, self.rotationPartrightdoor.minRot, 3, self.rotationPartrightdoor.rotTime, dt, not self.rotationMaxrightdoor);
		   setRotation(self.rotationPartrightdoor.node, unpack(newRot));
        end;
        if self.rotationPartleftdoor ~= nil then
		   local x, y, z = getRotation(self.rotationPartleftdoor.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartleftdoor.maxRot, self.rotationPartleftdoor.minRot, 3, self.rotationPartleftdoor.rotTime, dt, not self.rotationMaxleftdoor);
		   setRotation(self.rotationPartleftdoor.node, unpack(newRot));
        end;
        if self.rotationPartrightwindows ~= nil then
		   local x, y, z = getRotation(self.rotationPartrightwindows.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartrightwindows.maxRot, self.rotationPartrightwindows.minRot, 3, self.rotationPartrightwindows.rotTime, dt, not self.rotationMaxrightwindows);
		   setRotation(self.rotationPartrightwindows.node, unpack(newRot));
        end;
        if self.rotationPartleftwindows ~= nil then
		   local x, y, z = getRotation(self.rotationPartleftwindows.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartleftwindows.maxRot, self.rotationPartleftwindows.minRot, 3, self.rotationPartleftwindows.rotTime, dt, not self.rotationMaxleftwindows);
		   setRotation(self.rotationPartleftwindows.node, unpack(newRot));
        end;
        if self.rotationPartlyuk ~= nil then
		   local x, y, z = getRotation(self.rotationPartlyuk.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartlyuk.maxRot, self.rotationPartlyuk.minRot, 3, self.rotationPartlyuk.rotTime, dt, not self.rotationMaxlyuk);
		   setRotation(self.rotationPartlyuk.node, unpack(newRot));
        end;
        if self.rotationPartmufta ~= nil then
		   local x, y, z = getRotation(self.rotationPartmufta.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartmufta.maxRot, self.rotationPartmufta.minRot, 3, self.rotationPartmufta.rotTime, dt, not self.rotationMaxmufta);
		   setRotation(self.rotationPartmufta.node, unpack(newRot));
        end;
        if self.rotationParttum ~= nil then
		   local x, y, z = getRotation(self.rotationParttum.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationParttum.maxRot, self.rotationParttum.minRot, 3, self.rotationParttum.rotTime, dt, not self.rotationMaxtum);
		   setRotation(self.rotationParttum.node, unpack(newRot));
        end;
        if self.rotationParttumb ~= nil then
		   local x, y, z = getRotation(self.rotationParttumb.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationParttumb.maxRot, self.rotationParttumb.minRot, 3, self.rotationParttumb.rotTime, dt, not self.rotationMaxtumb);
		   setRotation(self.rotationParttumb.node, unpack(newRot));
        end;
        if self.rotationParttumbl ~= nil then
		   local x, y, z = getRotation(self.rotationParttumbl.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationParttumbl.maxRot, self.rotationParttumbl.minRot, 3, self.rotationParttumbl.rotTime, dt, not self.rotationMaxtumbl);
		   setRotation(self.rotationParttumbl.node, unpack(newRot));
        end;
        if self.rotationParttumble ~= nil then
		   local x, y, z = getRotation(self.rotationParttumble.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationParttumble.maxRot, self.rotationParttumble.minRot, 3, self.rotationParttumble.rotTime, dt, not self.rotationMaxtumble);
		   setRotation(self.rotationParttumble.node, unpack(newRot));
        end;
        if self.rotationParttumbler ~= nil then
		   local x, y, z = getRotation(self.rotationParttumbler.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationParttumbler.maxRot, self.rotationParttumbler.minRot, 3, self.rotationParttumbler.rotTime, dt, not self.rotationMaxtumbler);
		   setRotation(self.rotationParttumbler.node, unpack(newRot));
        end;
        if self.rotationPartruchnjak ~= nil then
		   local x, y, z = getRotation(self.rotationPartruchnjak.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartruchnjak.maxRot, self.rotationPartruchnjak.minRot, 3, self.rotationPartruchnjak.rotTime, dt, not self.rotationMaxruchnjak);
		   setRotation(self.rotationPartruchnjak.node, unpack(newRot));
        end;
	local doTranslate = self.translationHookMax or self.translationHookMin 
	if self.translationHook ~= nil and doTranslate then 
		local x, y, z = getTranslation(self.translationHook.node); 
		local trans = {x,y,z}; 
		local newTrans = Utils.getMovedLimitedValues(trans, self.translationHook.maxTrans, self.translationHook.minTrans, 3, self.translationHook.transTime, dt, not self.translationHookMax); 
		setTranslation(self.translationHook.node, unpack(newTrans)); 
	end;
	local doTranslate = self.translationHook2Max or self.translationHook2Min 
	if self.translationHook2 ~= nil and doTranslate then 
		local x, y, z = getTranslation(self.translationHook2.node); 
		local trans = {x,y,z}; 
		local newTrans = Utils.getMovedLimitedValues(trans, self.translationHook2.maxTrans, self.translationHook2.minTrans, 3, self.translationHook2.transTime, dt, not self.translationHook2Max); 
		setTranslation(self.translationHook2.node, unpack(newTrans)); 
	end;

--[[stop]]------------------------------------------------------------
if self.rotationPartbrakerihag ~= nil then
		local x, y, z = getRotation(self.rotationPartbrakerihag.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartbrakerihag.maxRot, self.rotationPartbrakerihag.minRot, 3, self.rotationPartbrakerihag.rotTime, dt, not self.rotationMaxbrakerihag);
		setRotation(self.rotationPartbrakerihag.node, unpack(newRot));

end;

	if self.handbrake then
		self.motor.maxRpm[1] = 0;
        self.motor.maxRpm[2] = 0;
        self.motor.maxRpm[3] = 0;
		
	 end;  
	
	
	if not self.handbrake then
	    self.motor.maxRpm[1] = 1000;
        self.motor.maxRpm[2] = 2500;
        self.motor.maxRpm[3] = 5900;
	end;	
 	







--[[panel]]------------------------------------------------------------
if self.isEntered then
		  if self.kablightsActive then
		   for i=1, self.numkablights do
		   local kablights = self.kablights[i];
		   setVisibility(kablights, self.kablightsActive);
		end;
	else
		for i=1, self.numkablights do
			local kablights = self.kablights[i];
			setVisibility(kablights, self.kablightsActive, false);
			setVisibility(self.kablights.outs, true);
		end;
	end;
	end;
--[[rul]]------------------------------------------------------------
if self.isEntered then
		  if self.frontlightsActive then
		   for i=1, self.numFrontlights do
		   local frontlight = self.frontlights[i];
		   setVisibility(frontlight, self.frontlightsActive);
		end;
	else
		for i=1, self.numFrontlights do
			local frontlight = self.frontlights[i];
			setVisibility(frontlight, self.frontlightsActive, false);
			setVisibility(self.frontlights.outs, true);
		end;
	end;
	end;

--[[val]]------------------------------------------------------------
if self.crankshaftNode ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaftNode, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft1Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft1Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft2Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft2Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;	
if self.crankshaft3Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft3Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;	
if self.crankshaft4Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft4Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft5Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft5Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft6Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft6Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft7Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft7Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft8Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft8Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft9Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft9Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft10Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft10Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft11Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft11Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;
if self.crankshaft12Node ~= nil and (self.movingDirection > 0 or self.movingDirection < 0) then
         	rotate(self.crankshaft12Node, 0, 0, self.motor.lastMotorRpm*0.001);
    	end;








if self.motor.lastMotorRpm > 300 and self.motor.lastMotorRpm < 650 then
self.rotationMaxkorobka = true;
self.rotationMaxkorobka0 = false;
self.rotationMaxkorobkazad = false;
	end;
if self.motor.lastMotorRpm > 650 and self.motor.lastMotorRpm < 700 then
self.rotationMaxkorobka = false;
self.rotationMaxkorobka1 = false;
self.rotationMaxkorobka0 = true;
self.rotationMaxkorobkazad = false;
	end;	
	
if self.motor.lastMotorRpm > 700 and self.motor.lastMotorRpm < 1050 then
self.rotationMaxkorobka1 = true;
self.rotationMaxkorobka0 = false;
self.rotationMaxkorobkazad = false;
	end;

if self.motor.lastMotorRpm > 1050 and self.motor.lastMotorRpm < 1100 then
self.rotationMaxkorobka1 = false;
self.rotationMaxkorobka2 = false;
self.rotationMaxkorobka0 = true;
self.rotationMaxkorobkazad = false;
	end;
	
if self.motor.lastMotorRpm > 1100 and self.motor.lastMotorRpm < 1550 then
self.rotationMaxkorobka2 = true;
self.rotationMaxkorobka0 = false;
self.rotationMaxkorobkazad = false;
	end;
if self.motor.lastMotorRpm > 1550 and self.motor.lastMotorRpm < 1600 then
self.rotationMaxkorobka2 = false;
self.rotationMaxkorobka3 = false;
self.rotationMaxkorobka0 = true;
self.rotationMaxkorobkazad = false;
	end;

	
if self.motor.lastMotorRpm > 1600 and self.motor.lastMotorRpm < 1950 then
self.rotationMaxkorobka3 = true;
self.rotationMaxkorobka0 = false;
self.rotationMaxkorobkazad = false;
	end;	
if self.motor.lastMotorRpm > 1950 and self.motor.lastMotorRpm < 2000 then
self.rotationMaxkorobka3 = false;
self.rotationMaxkorobka4 = false;
self.rotationMaxkorobka0 = true;
self.rotationMaxkorobkazad = false;
	end;	
if self.motor.lastMotorRpm > 2000 then
self.rotationMaxkorobka4 = true;
self.rotationMaxkorobka0 = false;
self.rotationMaxkorobkazad = false;
	end;	
if self.brakeSoundAllow then
self.rotationMaxkorobkazad = true;
self.rotationMaxkorobka0 = false;
self.rotationMaxkorobka = false;
self.rotationMaxkorobka1 = false;
self.rotationMaxkorobka2 = false;
self.rotationMaxkorobka3 = false;
self.rotationMaxkorobka4 = false;
	end;		
	
	
 if self.motor.lastMotorRpm < 300 then
self.rotationMaxkorobka0 = true;
self.rotationMaxkorobka = false;
self.rotationMaxkorobka1 = false;
self.rotationMaxkorobka2 = false;
self.rotationMaxkorobka3 = false;
self.rotationMaxkorobka4 = false;
self.rotationMaxkorobkazad = false;
	end;
	
	
if self.rotationMaxkorobka0 == true then
if self.rotationPartkorobka0 ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobka0.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobka0.maxRot, self.rotationPartkorobka0.minRot, 3, self.rotationPartkorobka0.rotTime, dt, not self.rotationMaxkorobka0);
		   setRotation(self.rotationPartkorobka0.node, unpack(newRot));
       end;
	   end;

if self.rotationMaxkorobka == true then
if self.rotationPartkorobka ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobka.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobka.maxRot, self.rotationPartkorobka.minRot, 3, self.rotationPartkorobka.rotTime, dt, not self.rotationMaxkorobka);
		   setRotation(self.rotationPartkorobka.node, unpack(newRot));
       end;
	   end;
if self.rotationMaxkorobka1 == true then	   
if self.rotationPartkorobka1 ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobka1.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobka1.maxRot, self.rotationPartkorobka1.minRot, 3, self.rotationPartkorobka1.rotTime, dt, not self.rotationMaxkorobka1);
		   setRotation(self.rotationPartkorobka1.node, unpack(newRot));
       end;
end;
if self.rotationMaxkorobka2 == true then
if self.rotationPartkorobka2 ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobka2.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobka2.maxRot, self.rotationPartkorobka2.minRot, 3, self.rotationPartkorobka2.rotTime, dt, not self.rotationMaxkorobka2);
		   setRotation(self.rotationPartkorobka2.node, unpack(newRot));
       end;
end;
 
if self.rotationMaxkorobka3 == true then
if self.rotationPartkorobka3 ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobka3.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobka3.maxRot, self.rotationPartkorobka3.minRot, 3, self.rotationPartkorobka3.rotTime, dt, not self.rotationMaxkorobka3);
		   setRotation(self.rotationPartkorobka3.node, unpack(newRot));
       end;
end;

if self.rotationMaxkorobka4 == true then
if self.rotationPartkorobka4 ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobka4.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobka4.maxRot, self.rotationPartkorobka4.minRot, 3, self.rotationPartkorobka4.rotTime, dt, not self.rotationMaxkorobka4);
		   setRotation(self.rotationPartkorobka4.node, unpack(newRot));
       end;
end;
if self.rotationMaxkorobkazad == true then
if self.rotationPartkorobkazad ~= nil then
		   local x, y, z = getRotation(self.rotationPartkorobkazad.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartkorobkazad.maxRot, self.rotationPartkorobkazad.minRot, 3, self.rotationPartkorobkazad.rotTime, dt, not self.rotationMaxkorobkazad);
		   setRotation(self.rotationPartkorobkazad.node, unpack(newRot));
       end;
end;















if self.starrr == true then

if self.isEntered then
		if self.fuelFillLevel < 50 then
			self.tankwarn = self.tankwarn - dt;
			if self.tankwarn <= 0 then
				playSample(self.fuelwarningSoundId,1,1,0);
				self.tankwarn = 30000;
			end;
			self.tanklightActive = true;
		else
			self.tankwarn = 30000;
			self.tanklightActive = false;
		end;
		setVisibility(self.tanklight,self.tanklightActive);
		setVisibility(self.tank2light,self.tanklightActive);
	end;

if self.rotationPartTanknadel ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel.node);
		y = ((self.rotationPartTanknadel.maxRot[2] - self.rotationPartTanknadel.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel.minRot[2];
		setRotation(self.rotationPartTanknadel.node, x, y ,z);
	end;
	
	if self.rotationPartTanknadel2 ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel2.node);
		y = ((self.rotationPartTanknadel2.maxRot[2] - self.rotationPartTanknadel2.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel2.minRot[2];
		setRotation(self.rotationPartTanknadel2.node, x, y ,z);
	end;

if self.isEntered then
		if self.fuelFillLevel < 50 then
			self.tankwarn = self.tankwarn - dt;
			if self.tankwarn <= 0 then
				playSample(self.fuelwarningSoundId,1,1,0);
				self.tankwarn = 30000;
			end;
			self.tanklightActive = true;
		else
			self.tankwarn = 30000;
			self.tanklightActive = false;
		end;
		setVisibility(self.tanklight,self.tanklightActive);
		setVisibility(self.tank2light,self.tanklightActive);
	end;
end;






local maxDrehzahl = 2900;
	if self.rotationPartDrehzahl1 ~= nil then
		local x, y, z = getRotation(self.rotationPartDrehzahl1.node);
		y = ((self.rotationPartDrehzahl1.maxRot[2] - self.rotationPartDrehzahl1.minRot[2]) / maxDrehzahl) * self.motor.lastMotorRpm + self.rotationPartDrehzahl1.minRot[2];
		setRotation(self.rotationPartDrehzahl1.node, x, y ,z);
	end;
	if self.rotationPartDrehzahl2 ~= nil then
		local x, y, z = getRotation(self.rotationPartDrehzahl2.node);
		y = ((self.rotationPartDrehzahl2.maxRot[2] - self.rotationPartDrehzahl2.minRot[2]) / maxDrehzahl) * self.motor.lastMotorRpm + self.rotationPartDrehzahl2.minRot[2];
		setRotation(self.rotationPartDrehzahl2.node, x, y ,z);
	end;




local maxKmh = 50;
	if self.rotationPartKmh1 ~= nil then
		local x, y, z = getRotation(self.rotationPartKmh1.node);
		y = ((self.rotationPartKmh1.maxRot[2] - self.rotationPartKmh1.minRot[2]) / maxKmh) * self.lastSpeed*3600 + self.rotationPartKmh1.minRot[2];
		setRotation(self.rotationPartKmh1.node, x, y ,z);
	end;
	if self.rotationPartKmh2 ~= nil then
		local x, y, z = getRotation(self.rotationPartKmh2.node);
		y = ((self.rotationPartKmh2.maxRot[2] - self.rotationPartKmh2.minRot[2]) / maxKmh) * self.lastSpeed*3600 + self.rotationPartKmh2.minRot[2];
		setRotation(self.rotationPartKmh2.node, x, y ,z);
	end;
















	               if self.wiper1Active then
			   if self.delayWischer1 >= 0 then
				self.delayWischer1 = self.delayWischer1 -dt;
			end;
			   if self.delayWischer2 >= 0 then
				self.delayWischer2 = self.delayWischer2 -dt;
			end;
			     if not self.wiper1Max then
				   if self.delayWischer1 < 0 then
					self.delayWischer2 = 1000;
					self.wiper1Max = true;
					self.wiper2Max = true;
					self.wiper3Max = true;
					self.wiper4Max = true;
					self.wiper5Max = true;
					self.wiper6Max = true;
				end;
			end;
			         if self.wiper1Max then
				   if self.delayWischer2 < 0 then
					self.delayWischer1 = 1000;
					self.wiper1Max = false;
					self.wiper2Max = false;
					self.wiper3Max = false;
					self.wiper4Max = false;
					self.wiper5Max = false;
					self.wiper6Max = false;
				end;
			end;
		else
			self.wiper1Max = false;
			self.wiper2Max = false;
			self.wiper3Max = false;
			self.wiper4Max = false;
			self.wiper5Max = false;
			self.wiper6Max = false;
		end;

      if self.wiper1 ~= nil then
        	local x, y, z = getRotation(self.wiper1.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper1.maxRot, self.wiper1.minRot, 3, self.wiper1.rotTime, dt, not self.wiper1Max);
        	setRotation(self.wiper1.node, unpack(newRot));
    	end;
		
	if self.wiper2 ~= nil then
        	local x, y, z = getRotation(self.wiper2.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper2.maxRot, self.wiper2.minRot, 3, self.wiper2.rotTime, dt, not self.wiper2Max);
        	setRotation(self.wiper2.node, unpack(newRot));
    	end;
      if self.wiper3 ~= nil then
        	local x, y, z = getRotation(self.wiper3.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper3.maxRot, self.wiper3.minRot, 3, self.wiper3.rotTime, dt, not self.wiper3Max);
        	setRotation(self.wiper3.node, unpack(newRot));
    	end;
		
	if self.wiper4 ~= nil then
        	local x, y, z = getRotation(self.wiper4.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper4.maxRot, self.wiper4.minRot, 3, self.wiper4.rotTime, dt, not self.wiper4Max);
        	setRotation(self.wiper4.node, unpack(newRot));
    	end;
      if self.wiper5 ~= nil then
        	local x, y, z = getRotation(self.wiper5.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper5.maxRot, self.wiper5.minRot, 3, self.wiper5.rotTime, dt, not self.wiper5Max);
        	setRotation(self.wiper5.node, unpack(newRot));
    	end;
		
	if self.wiper6 ~= nil then
        	local x, y, z = getRotation(self.wiper6.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper6.maxRot, self.wiper6.minRot, 3, self.wiper6.rotTime, dt, not self.wiper6Max);
        	setRotation(self.wiper6.node, unpack(newRot));
    	end;







        if self.isTurnedOn then
        if self.wentelatorNode1 ~= nil then
				rotate(self.wentelatorNode1, self.wentelatorRotationScale * 5 * 1, 0, 0);
			end;			

        end;

        if self.isTurnedOn1 then
        if self.wentelator1Node1 ~= nil then
				rotate(self.wentelator1Node1, self.wentelator1RotationScale * 5 * 1, 0, 0);
			end;			

        end;

        if self.isTurnedOn2 then
        if self.wentelator2Node1 ~= nil then
				rotate(self.wentelator2Node1, self.wentelator2RotationScale * 5 * 1, 0, 0);
			end;			

        end;

        if self.isTurnedOn3 then
        if self.wentelator3Node1 ~= nil then
				rotate(self.wentelator3Node1, self.wentelator3RotationScale * 5 * 1, 0, 0);
			end;			

        end;



	               if self.motor1Active then
			   if self.delayKurs1 >= 0 then
				self.delayKurs1 = self.delayKurs1 -dt;
			end;
			   if self.delayKurs2 >= 0 then
				self.delayKurs2 = self.delayKurs2 -dt;
			end;
			     if not self.motor1Max then
				   if self.delayKurs1 < 0 then
					self.delayKurs2 = 70;
					self.motor1Max = true;
					self.motor2Max = true;
					self.motor3Max = true;
				end;
			end;
			         if self.motor1Max then
				   if self.delayKurs2 < 0 then
					self.delayKurs1 = 70;
					self.motor1Max = false;
					self.motor2Max = false;
					self.motor3Max = false;
				end;
			end;
		else
			self.motor1Max = false;
			self.motor2Max = false;
			self.motor3Max = false;
		end;


      if self.motor1 ~= nil then
        	local x, y, z = getRotation(self.motor1.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.motor1.maxRot, self.motor1.minRot, 3, self.motor1.rotTime, dt, not self.motor1Max);
        	setRotation(self.motor1.node, unpack(newRot));
    	end;

      if self.motor2 ~= nil then
        	local x, y, z = getRotation(self.motor2.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.motor2.maxRot, self.motor2.minRot, 3, self.motor2.rotTime, dt, not self.motor2Max);
        	setRotation(self.motor2.node, unpack(newRot));
    	end;

      if self.motor3 ~= nil then
        	local x, y, z = getRotation(self.motor3.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.motor3.maxRot, self.motor3.minRot, 3, self.motor3.rotTime, dt, not self.motor3Max);
        	setRotation(self.motor3.node, unpack(newRot));
    	end;






      if self.rotationMaxpoworotnikk == false and self.rotationMaxpoworotnik == false and self.rotationMaxpoworotnika == false then
      self.rotationMaxpoworotnik0 = true
      end;	


	if self.rotationMaxpoworotnika == true then
               if self.rotationPartpoworotnika ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnika.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnika.maxRot, self.rotationPartpoworotnika.minRot, 3, self.rotationPartpoworotnika.rotTime, dt, not self.rotationMaxpoworotnika);
		   setRotation(self.rotationPartpoworotnika.node, unpack(newRot));
       end;
         end;		
	if self.rotationMaxpoworotnikk == true then
               if self.rotationPartpoworotnikk ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnikk.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnikk.maxRot, self.rotationPartpoworotnikk.minRot, 3, self.rotationPartpoworotnikk.rotTime, dt, not self.rotationMaxpoworotnikk);
		   setRotation(self.rotationPartpoworotnikk.node, unpack(newRot));
       end;
	   end;
               if self.rotationMaxpoworotnik == true then
               if self.rotationPartpoworotnik ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnik.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnik.maxRot, self.rotationPartpoworotnik.minRot, 3, self.rotationPartpoworotnik.rotTime, dt, not self.rotationMaxpoworotnik);
		   setRotation(self.rotationPartpoworotnik.node, unpack(newRot));
       end;
	   end;

               if self.rotationMaxpoworotnik0 == true then
               if self.rotationPartpoworotnik0 ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnik0.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnik0.maxRot, self.rotationPartpoworotnik0.minRot, 3, self.rotationPartpoworotnik0.rotTime, dt, not self.rotationMaxpoworotnik0);
		   setRotation(self.rotationPartpoworotnik0.node, unpack(newRot));
       end;
	   end;




	if self.rotationPartrichag1 ~= nil then
		local x, y, z = getRotation(self.rotationPartrichag1.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartrichag1.maxRot, self.rotationPartrichag1.minRot, 3, self.rotationPartrichag1.rotTime, dt, not self.rotationMaxrichag1);
		setRotation(self.rotationPartrichag1.node, unpack(newRot));
	end;

	if self.rotationPartrichag2 ~= nil then
		local x, y, z = getRotation(self.rotationPartrichag2.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartrichag2.maxRot, self.rotationPartrichag2.minRot, 3, self.rotationPartrichag2.rotTime, dt, not self.rotationMaxrichag2);
		setRotation(self.rotationPartrichag2.node, unpack(newRot));
	end;

	if self.rotationPartrichag3 ~= nil then
		local x, y, z = getRotation(self.rotationPartrichag3.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartrichag3.maxRot, self.rotationPartrichag3.minRot, 3, self.rotationPartrichag3.rotTime, dt, not self.rotationMaxrichag3);
		setRotation(self.rotationPartrichag3.node, unpack(newRot));
	end;

	if self.rotationPartrichag4 ~= nil then
		local x, y, z = getRotation(self.rotationPartrichag4.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartrichag4.maxRot, self.rotationPartrichag4.minRot, 3, self.rotationPartrichag4.rotTime, dt, not self.rotationMaxrichag4);
		setRotation(self.rotationPartrichag4.node, unpack(newRot));
	end;

	if self.rotationPartPedal3 ~= nil then
		local x, y, z = getRotation(self.rotationPartPedal3.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedal3.maxRot, self.rotationPartPedal3.minRot, 3, self.rotationPartPedal3.rotTime, dt, not self.rotationMaxPedal3);
		setRotation(self.rotationPartPedal3.node, unpack(newRot));
	end;

	if self.rotationPartPedal2 ~= nil then
		local x, y, z = getRotation(self.rotationPartPedal2.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedal2.maxRot, self.rotationPartPedal2.minRot, 3, self.rotationPartPedal2.rotTime, dt, not self.rotationMaxPedal2);
		setRotation(self.rotationPartPedal2.node, unpack(newRot));
	end;

	if self.rotationPartPedalr ~= nil then
		local x, y, z = getRotation(self.rotationPartPedalr.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedalr.maxRot, self.rotationPartPedalr.minRot, 3, self.rotationPartPedalr.rotTime, dt, not self.rotationMaxPedalr);
		setRotation(self.rotationPartPedalr.node, unpack(newRot));
	end;

	if self.rotationPartPedal ~= nil then
		local x, y, z = getRotation(self.rotationPartPedal.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedal.maxRot, self.rotationPartPedal.minRot, 3, self.rotationPartPedal.rotTime, dt, not self.rotationMaxPedal);
		setRotation(self.rotationPartPedal.node, unpack(newRot));
	end;

     if self.rotationPartBrake ~= nil then
		local x, y, z = getRotation(self.rotationPartBrake.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartBrake.maxRot, self.rotationPartBrake.minRot, 3, self.rotationPartBrake.rotTime, dt, not self.rotationMaxBrake);
		setRotation(self.rotationPartBrake.node, unpack(newRot));
	end;

	local doTranslate = self.translationMax or self.translationMin 
	if self.translationPart ~= nil and doTranslate then 
		local x, y, z = getTranslation(self.translationPart.node); 
		local trans = {x,y,z}; 
		local newTrans = Utils.getMovedLimitedValues(trans, self.translationPart.maxTrans, self.translationPart.minTrans, 3, self.translationPart.transTime, dt, not self.translationMax); 
		setTranslation(self.translationPart.node, unpack(newTrans)); 
	end; 
	local doTranslate = self.translationMax2 or self.translationMin2 
	if self.translationPart2 ~= nil and doTranslate then 
		local x, y, z = getTranslation(self.translationPart2.node); 
		local trans = {x,y,z}; 
		local newTrans = Utils.getMovedLimitedValues(trans, self.translationPart2.maxTrans, self.translationPart2.minTrans, 3, self.translationPart2.transTime, dt, not self.translationMax2); 
		setTranslation(self.translationPart2.node, unpack(newTrans)); 
	end;

	local doRotate = self.rotation6Max or self.rotation6Min 
	if self.rotation6 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation6.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation6.maxRot, self.rotation6.minRot, 3, self.rotation6.rotTime, dt, not self.rotation6Max);
        setRotation(self.rotation6.node, unpack(newRot));
    end;

	local doRotate = self.rotation7Max or self.rotation7Min 
	if self.rotation7 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation7.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation7.maxRot, self.rotation7.minRot, 3, self.rotation7.rotTime, dt, not self.rotation7Max);
        setRotation(self.rotation7.node, unpack(newRot));
    end;
	
	local doRotate = self.rotation8Max or self.rotation8Min 
	if self.rotation8 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation8.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation8.maxRot, self.rotation8.minRot, 3, self.rotation8.rotTime, dt, not self.rotation8Max);
        setRotation(self.rotation8.node, unpack(newRot));
    end;
	
	local doRotate = self.rotation9Max or self.rotation9Min 
	if self.rotation9 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation9.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation9.maxRot, self.rotation9.minRot, 3, self.rotation9.rotTime, dt, not self.rotation9Max);
        setRotation(self.rotation9.node, unpack(newRot));
    end;





if self.rotationPartru4ka1 ~= nil then
		local x, y, z = getRotation(self.rotationPartru4ka1.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartru4ka1.maxRot, self.rotationPartru4ka1.minRot, 3, self.rotationPartru4ka1.rotTime, dt, not self.rotationMaxru4ka1);
		setRotation(self.rotationPartru4ka1.node, unpack(newRot));

end;

if self.rotationPartru4ka2 ~= nil then
		local x, y, z = getRotation(self.rotationPartru4ka2.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartru4ka2.maxRot, self.rotationPartru4ka2.minRot, 3, self.rotationPartru4ka2.rotTime, dt, not self.rotationMaxru4ka2);
		setRotation(self.rotationPartru4ka2.node, unpack(newRot));

end;




	if self.rotationPartLeft11 ~= nil then
		local x, y, z = getRotation(self.rotationPartLeft11.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartLeft11.maxRot, self.rotationPartLeft11.minRot, 3, self.rotationPartLeft11.rotTime, dt, not self.rotationMaxLeft11);
		setRotation(self.rotationPartLeft11.node, unpack(newRot));
	end;

end;











function Teleskopladerser:draw()


--[[info]]------------------------------------------------------------
 if self.isEntered then
		if not self.helpPanel then
			renderText(0.86, 0.18, 0.025, "Taste 9: Info");
		else
			renderText(0.86, 0.18, 0.025, "Taste 9: Info");
		end;
		if self.helpPanel then
			renderText(0.84, 0.84, 0.025, "* Info *");
			renderText(0.8, 0.82, 0.02, "num 4: lev.dver ");		
			renderText(0.8, 0.80, 0.02, "num 6: prav.dver ");
			renderText(0.8, 0.78, 0.02, "num 7: lev.okno ");
			renderText(0.8, 0.76, 0.02, "num 9 : prav.okno ");
			renderText(0.8, 0.74, 0.02, "num 5: lyuk ");
			renderText(0.8, 0.72, 0.02, "num 8: kryuk ");
			renderText(0.8, 0.70, 0.02, "num 2: avariyka ");
			renderText(0.8, 0.68, 0.02, "num 1: lev.povorotnik ");
			renderText(0.8, 0.66, 0.02, "num 3: prav.povorotnik ");
                  renderText(0.8, 0.64, 0.02, "num *: ventelator ");
                  renderText(0.8, 0.62, 0.02, "num 0: 4x4 ");
                  renderText(0.8, 0.60, 0.02, "num enter: start motor ");
                  renderText(0.8, 0.58, 0.02, "Y : dvorniki ");
                  renderText(0.8, 0.56, 0.02, "T : VOM ");
                  renderText(0.8, 0.54, 0.02, "F : svet ");
                  renderText(0.8, 0.52, 0.02, "l : robochiy svet ");
                  renderText(0.8, 0.50, 0.02, "j : svet v kabine ");
                  renderText(0.8, 0.48, 0.02, "K : kapot ");
                  renderText(0.8, 0.46, 0.02, "M/N : Rul ");
                  renderText(0.8, 0.44, 0.02, "Spase : ruchnyak ");
                  renderText(0.84, 0.41, 0.025, " ANUBIS95 ");
		end;
       end;

end;



function Teleskopladerser:connectCollisions(varName)
	local Collision = self.collisionArm[varName];
	local constr = JointConstructor:new();
	constr:setActors(self.rootNode, Collision.collision);
	constr:setJointTransforms(Collision.armAttacher, Collision.collisionAttacher);
	for i=1, 3 do
		constr:setRotationLimit(i-1, 0, 0, 0);
		constr:setTranslationLimit(i-1, true, 0, 0);
	end;
	Collision.index = constr:finalize();
end;










