--
-- compass
-- Class for Claas compass
--
-- @author  JACK (ICQ brauchst du nicht )
-- @date  21/04/09

compass = {};

function compass.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;

function compass:load(xmlFile)
end;


function compass:readStream(streamId, connection)
end;

function compass:writeStream(streamId, connection)
end;
function compass:keyEvent(unicode, sym, modifier, isDown)
end;

function compass:update(dt)
end;

function compass:draw()
	local x,y,z = localDirectionToWorld(self.rootNode, 0, 0, 1);
	local length = Utils.vector2Length(x,z);
	local dX = x/length;
	local dZ = z/length;
	local Richtung = math.deg(math.atan2(dX,dZ));
	if Richtung < 0  then 
		Richtung = 360 - (Richtung * -1);
    end;
	renderText(0.85,0.85,0.03,string.format("Dir: %3.0f ",360 - math.floor(Richtung + 0.5) ));
end;
	
	
function compass:mouseEvent(posX, posY, isDown, isUp, button)
end;

function compass:onEnter()
end;
	
function compass:delete()
end;

function compass:onLeave() 
end;

