Jump to content

Calculation of Blips on a Custom radar


Recommended Posts

Hi,

So i need Help by calculating the position from blips on a image ( the map )

So is started like this

  
        local radarTexture = dxCreateTexture("radar.jpg") 
        local imgW,imgH    = dxGetMaterialSize(radarTexture) 
        local width, height = 1200,1200 
        local blipRenderTarget= dxCreateRenderTarget( s[1]*1200/1440, s[2]*1200/900,true )  
    addEventHandler ("onClientHUDRender",root, 
            function () 
                dxSetRenderTarget(BLIPS,true)    
            dxDrawImage ( 0,0,1200,1200, blipTexture)        
                   for k,v in ipairs(getElementsByType ("blip")) do 
                        local x,y = getElementPosition(v) 
                                local b_x = x / (6000/imgW) + imgW/2 - width*0.73 
                                local b_y = y / (-6000/imgH) + imgH/2 - height*0.74 
                                local blip_icon = getBlipIcon  ( v) 
                                blip_size = 40 
                              dxDrawImage ( b_x-blip_size/2,b_y-blip_size/2,blip_size/2,blip_size/2, "blips/"..blip_icon..".png") 
                    end 
                dxSetRenderTarget()    
   
        dxDrawImage (500,0,imgW/4,imgH/4, blipRenderTarget)  
    end)     
  

So, i need now a way to calculate where the "blip" is on the image.

Hope you guys understood my question.

Regards

Link to comment

Well, I don't know about the rest of your script.

But I guess you can easily get the radar position of your player blip, the radar position of that other blip, do some math and use your players world position to get the blips world position.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...