Calculating In-Game map positions

This topic is 2172 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello everyone,

I have an issue. I'm not going to send what I have because it's extremely hard to understand and most likely horribly written because of my lack of knowledge on this subject. So lets just start from a simple approach, if I want to take a game object and put its position on a world map or mini map how would I take that 3D position and convert it to a 2D position that can be used to position the map marker?

Thanks to anyone who can help me!

Share on other sites
One of the approaches is to make two more render passes for your scene. The first new one would render to texture everything from the camera which is located in the sky. In the second new render pass you render this texture to the place on the screen you want.

Share on other sites
Thanks DgekGD, I'll try that out. It actually sounds like a really good way of doing it. If anyone else has any suggestions on this, please let me know.

Share on other sites
If you already have a top-down overview image of your map, you could just convert your object's position into "minimap coords".

To convert between real coordinates and minimap coordinates:
normalized_coordinate = object_position / map_bounds
minimap_coordinate = normalized_coordinate * minimap_bounds

For example:
Real map is 100 units X and 100 units Y
Minimap is 256 pixels wide and 256 pixels high
Object is positioned at 50,50 (center of map)

50 / 100 = 0.5 so the normalized object position would be 0.5, 0.5
0.5 * 256 = 128 so the unit should be positioned at pixel 128,128 in the minimap

Hope that makes sense, this was written while eating a donut

Cheers

1. 1
Rutin
34
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 9
• Forum Statistics

• Total Topics
633331
• Total Posts
3011399
• Who's Online (See full list)

There are no registered users currently online

×