Home Technical Talk

Calculating Source Overview/Radar map X/Y and Scale

polycounter lvl 15
Offline / Send Message
shawnolson polycounter lvl 15
I am building an overview/radar map exporter into Wall Worm. But right now I'm having a problem figuring out the correct pos_x, pos_y and scale of the text file that controls the overview map.

[ame="https://www.youtube.com/watch?v=GJAlaePTuOo"]Source Overview and Radar Exporter Preview - YouTube[/ame]

My gut tells me that the pos_x and pos_y are already correct but the scale is wrong. But I may be wrong.

What I am doing is creating an orthogonal view from above. Once the user sets the viewport to the required position and zoom, this is how I'm calculating the values (which are not working properly in Source):
   mapsize  = 32768
 
   local vpTransform = inverse (viewport.getTM())
 
   local pos_x = vpTransform[4].x
   local pos_y = vpTransform[4].y 
 
   local outScale = mapsize / (gw.getVPWorldWidth [0,0,0] )
 
 

Any ideas?
Sign In or Register to comment.