bin jetzt mal den anderen weg gegangen um mein ziel zu erreichen
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
self.KompassX = dX
self.KompassZ = dZ
renderText(0.85,0.8,0.03,string.format("Richtung: %d ",360 - Richtung ));
am ende der DRAW-sektion in der xerion.lua
function AITractor:draw()
if not g_currentMission.disableTractorAI then
if self.aiLeftMarker ~= nil and self.aiRightMarker ~= nil and self.aiBackMarker ~= nil then
if self.isAITractorActivated then
g_currentMission:addHelpButtonText(g_i18n:getText("DismissEmployee"), InputBinding.TOGGLE_AI);
else
g_currentMission:addHelpButtonText(g_i18n:getText("HireEmployee"), InputBinding.TOGGLE_AI);
if self.aiTractorDirectionX and self.aiTractorDirectionZ then
g_currentMission:addHelpButtonText(g_i18n:getText("AIcourse"), InputBinding.AI_COURSE)
if InputBinding.hasEvent(InputBinding.AI_COURSE) then
self.aiTractorDirectionX = nil;self.aiTractorDirectionZ = nil
end
end;end
if self.KompassX and self.KompassZ then
g_currentMission:addHelpButtonText(g_i18n:getText("Kompass"), InputBinding.KOMPASS)
if InputBinding.hasEvent(InputBinding.KOMPASS) then
self.aiTractorDirectionX = self.KompassX;self.aiTractorDirectionZ = self.KompassZ
end;end
end;
end;
end;
so sollte die DRAW-sektion in der AIUpdate.lua aussehen
<modDesc descVersion="1">
<author>Micha381</author>
<version>1.0</version>
<l10n>
<text name="AIcourse">
<en>delete AI Course</en>
<de>AI Kurs löschen </de>
</text>
<text name="Kompass">
<en>Copy Compass</en>
<de>Kompass kopieren </de>
</text>
</l10n>
<extraSourceFiles>
<sourceFile filename="AIUpdate.lua" />
<sourceFile filename="tankSaving.lua" />
</extraSourceFiles>
<inputBindings>
<input name="AI_COURSE" key="KEY_0" button="" />
<input name="KOMPASS" key="KEY_k" button="" />
</inputBindings>
</modDesc>
und so die modDesc des AIUpdates aussehen
für verbesserungen bin ich offen