How can I adapt this script to the following needs?

I want to be able to...

  • move camera only
  • camera travel a long the mini map shows the map in a litle circle in a corner of the screen
  • without Character
  • press a button to back to start place
  • parent camera again to the character and walk with the camera follow the character

the following script is very simple in terms of operation, the camera follows the character and you see the mini map with your route, how can I modify it or how can I create this from scratch?

# Script HUD Mini Map FPS 

from bge import logic, texture

scene_main = None
for scene in logic.getSceneList():

# Declarar nombre de la escena
    if scene.name == "Level1":
            scene_main = scene

# Declarar nombre de cámara para crear la textura      
mapcam = scene_main.objects["map_cam"]

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

# Declarar nombre textura: IM + (nombre de la imagen creada )
matID = texture.materialID(own, "IMMap")
map_png = texture.Texture(own, matID)

source = texture.ImageRender(scene_main, mapcam)
source.background = (20, 20, 20, 255)
  • 1
    $\begingroup$ ok i download but need study the script $\endgroup$ – user52430 Feb 15 '18 at 21:32
  • 1
    $\begingroup$ ok i tray a new script in a few days, see yo later $\endgroup$ – user33985 Feb 15 '18 at 21:51
  • 1
    $\begingroup$ with logic bricks is posible ??? or not posible ?! $\endgroup$ – user33985 Feb 15 '18 at 21:54

Moving map camera

The code snippet does not move the camera at all.

I guess it is supposed to setup the VideoTexture source of an object that shows the output of the map camera.

You simply move the map camera as you like. I guess you break the parent-child relationship to the character to achieve what you are looking for.

Finding the minimap camera

The code snippet contains a strange way to find the minimap camera.

I suggest following search:

for scene in logic.getSceneList():
    mapcam = scene.cameras.get("map_cam")


You already split the task down into smaller operations. This is good.

My above answer was telling you how to improve your code snippet, which btw. does not do any of the described operations. So I'm a bit lost where your problems are.

I suggest to discuss that in a forum like blenderartist.org or ask single more specific questions.

Here is a short strip down of the mentioned operations.

move camera only

As easy as it sounds. Do not parent it to something. Apply logic to move the camera.

camera travel a long the mini map shows the map in a litle circle in a corner of the screen

Do you mean you want to minimap shown in an edge of the window?

enter image description here

  • Place a mesh object (disc) there.
  • Add UV and a material with a texture
  • apply the videotexture as you mentioned in your snippet to show the render of the minimap camera. (You might want to use the DynamicTexture project if you are not that familar with Python)
  • refresh the texture at each single frame

without Character

This depends on what the minimap camera is seeing.

Typically you do not show the same thing as the main camera. You show a corresponding "level" that contains a map (several objects that form the map).

enter image description here

The minimap camera gets moved over this map. As result the minimap object (see section above) will show different parts of the map (rather than the level). As the map does not contain the character, it will not be visible.

The trick is to know how to move the minimap camera to get a correlation to the level camera.

press a button to back to start place

Play an action that set the minimap camera to that start place (above the map)

parent camera again to the character and walk with the camera follow the character

Parenting is an option. This will work fine when

  • the level is the map
  • the map is at an offset of the level and has the same scale as the level (e.g it is under the ground.

Example: the map is under the terrain:

enter image description here (side view)

It will not work fine when * the map is in a different scene * the map has a different scale or orientation

In such cases you need Python to synchronize the motion of the minimap camera with the motion of the character.

  • 1
    $\begingroup$ sorry the rules of double standards of this web system forces me to erase everything written to unlock my functions $\endgroup$ – user33985 Feb 14 '18 at 21:00
  • 1
    $\begingroup$ can you give me a bote in my Ask pleas $\endgroup$ – user33985 Feb 15 '18 at 22:05
  • 1
    $\begingroup$ @Monster how ??? $\endgroup$ – user52476 Feb 20 '18 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy