ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperLicht
2D worldmap radar
Author Text

Registered User
2015-09-09 23:18:33

Hi all,

can someone provide an algorithm for how to transform 3D player coordinates on a 2d Overlay to use as a radar? I lost with the math :-(

Thanks a lot

2015-09-10 05:07:38

I'd simply do it like that: You usually have coordinates like (120, 34,45) etc. The Y coordinate is height, so you just ignore that, and just use the X and Z coordinates for drawing. If you draw a 2D map, then simply for the example point (120, 34,45), draw a 2D point at (120, 45). No math needed, actually :)

If you want to change the scale a bit (= zoom) for the 2D map, just apply a zoom value. So for 50 zoom, draw it for example with these coordinates:

(120*0.5, 45*0.5). That's it. :)

Registered User
2015-09-10 14:49:53

Hi Niko,

thank for your answer, the problem with the math was more ment in regards to the transformation of the 2D element boundaries.
At the moment I use simply a DIV as the map lets say 400x300px of size and a 5px span inside which will be the player.

When I do something like this: = "" + Math.round(player.Pos.X) + "px"; = "" + Math.round(player.Pos.Z) + "px";

it surely works at first place, but without regards of the boundaries and dimensions of the wordmap DIV...

2015-09-12 06:44:03

Yes, you need to scale this probably, depending on how you made the map. Scaling is usually done by multiplying both values with a factor, for example 0.5 or similar.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inter?ational" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Software: Ambiera Light Forum. © 2008-2018 Nikolaus Gebhardt, Ambiera e.U.