Hallo,
ich versuche ein Busfahrer Job zu erstellen und möchte nun die Linie zb: "Linie 1" vorne am Bus stehen haben. Mit dxDrawText bekomme ich den Text auch hin das klappt alles. Hab den Text auch schon soweit positionniert das es Perfekt ist. Sobald ich aber um eine Kurve fahre ist aber der Text nicht mehr vorne am Bus sondern hängt links oder rechts in der luft.
Kennt jemand ne Lösung das sich das automatisch der Rotation anpasst ? hier mal ein bisschen code
Lua
function showBusLine(playerBus, text, showBool)
--dxDrawText(text, 10,100)
function drawTextBusLine()
local x,y,z = getElementPosition( playerBus )
local gsx, gsy = getScreenFromWorldPosition(x + 5, y, z + 2)
local gpx, gpy, gpz = getCameraMatrix()
if isLineOfSightClear( x, y, z, gpx, gpy, gpz, true, false, false ) then
if getDistanceBetweenPoints3D(x, y, z, gpx, gpy, gpz) < 30 then
if (gsx) and (gsy) then
dxDrawText(text, gsx, gsy, gsx, gsy, tocolor(255, 255, 255, 255), 1, "bankgothic", "center", "top", false, false, false, true, false, 0, 5, 0 )
end
end
end
end
if showBool == "true" then
addEventHandler("onClientRender", getRootElement(), drawTextBusLine)
else
removeEventHandler("onClientRender", getRootElement(), drawTextBusLine)
end
end
Alles anzeigen
Danke für jede antwort