Map view

Hello guys,
I’m working on a little game on blender and I want please some help with this.
I want to put a little map in the bottom of my game, so that the player can know where to go…
a kind of Camera that films from the top, and it’s displayed as a little map.
is it possible ? Thanks in advance ! and sorry for my bad english.

You can make an overlay scene with an plane,that uses the cameraview as Texture.
Here is an example script.


from bge import logic, texture

scene_main = None
for scene in logic.getSceneList():
        if scene.name == "main":   # the scene where you are playing
            scene_main = scene
            break
        
mapcam = scene_main.objects["mapcam"] #name of the Camera used for the minimap

cont = logic.getCurrentController()
own = cont.owner

matID = texture.materialID(own, "IMmap")
map_png = texture.Texture(own, matID)

source = texture.ImageRender(scene_main, mapcam)
source.background = (20, 20, 20, 255)

map_png.source = source

def main():
    
    map_png.refresh(True)
    

How to use:

  • Add a Camera and name it(like in the script) “mapcam”.
  • Add a Scene and name it “overlay”.
  • Make a new image in the Uv image editor.(name = map | size = like your camera resolution)
  • Add an plane and unwrap it with the image map.
  • Make a new Material and add the map texture as generated texture.(at source chose generated)
  • Make a new Text and copy the Script above in it.(name it like you want)
  • Add an always sensors(true level) and execute an python module (“Yourscriptname”.main).
  • Go back to your main scene and add an Scene Actuator with an overlay scene(“overlay”).
  • Connect you Scene Actuator with an Always sensors(not true level).
  • Done

you can even use viewports if you do not care the rectangle format

Had the script handy.

Attachments

map.blend (631 KB)

You can make a small Mini Map by rendering a specific camera view to texture.

Here’s a video tutorial that shows how to do that: http://www.youtube.com/watch?v=HgXAv9csJu0#t=1m22s

Thanks for you all guys !! :slight_smile: