KryPtoHolYx Posted March 5, 2014 Share Posted March 5, 2014 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
WhoAmI Posted March 5, 2014 Share Posted March 5, 2014 viewtopic.php?f=91&t=71784 maybe that would help you Link to comment
KryPtoHolYx Posted March 5, 2014 Author Share Posted March 5, 2014 (edited) Didn´t helped me at all, i build mine with rotation, so it may be different idk. at all, thanks for posting this. Regards Edited March 5, 2014 by Guest Link to comment
Bonsai Posted March 5, 2014 Share Posted March 5, 2014 So its not about making blips be shown at right position? You just want to get their position? At some point you set their position, so you could just save it there. Link to comment
KryPtoHolYx Posted March 5, 2014 Author Share Posted March 5, 2014 @Bonsai: I mean it like this, its about getting the position from the blip on my radar. atm it looks like this Regards Link to comment
Bonsai Posted March 6, 2014 Share Posted March 6, 2014 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
KryPtoHolYx Posted March 6, 2014 Author Share Posted March 6, 2014 Thanks for the Help, i got it. Now i draw the map on a renderTarget then draw every blip/radararea on it, and then start drawing the main thing. Regards Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now