Hey Guys,
so i tried to rotate my radar using rendertargets, but that just doesn't want to be how i want it.
It rotates really awkward and i don't know why.
Looks like this:
I want that it just rotates normally between the rendertarget.
--Created rendertarget
addEventHandler("onClientRender",root,
function( )
showPlayerHudComponent( "all", false )
showPlayerHudComponent("crosshair", true)
local px ,py, pz = getElementPosition( localPlayer )
local playerZone = getZoneName( px ,py, pz )
local mapX = px / ( 6000 / 6000 ) + ( 6000 / 2 ) - ( width / 2 )
local mapY = py / ( -6000 / 6000 ) + ( 6000 / 2 ) - ( height / 2 )
local cx,cy,cz,tx,ty,tz = getCameraMatrix( )
local rotation = findRotation( cx,cy,tx,ty )
if rendertar then
dxSetRenderTarget(rendertar)
dxDrawImageSection( 0, 0, width, height, mapX, mapY, width , height , "map.jpg", rotation, 0, 0, tocolor( 255, 255, 255, 255 ), false )
dxSetRenderTarget()
else
outputChatBox(rendertar)
end
dxDrawImage(posX, screeny - posY, width, height, rendertar)
dxDrawImage( posX + width / 2, screeny - posY + height / 2, 10, 10, "files/me.png" )
function findRotation( x1, y1, x2, y2 )
local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) )
if t < 0 then
t = t + 360
end
return t
end
end)
Regards,
KRZO