1
\$\begingroup\$

All tutorials I've found about this link to the splitscreen demo, but it is made under Godot version 2 and does not work in version 3.

I want to render the world in the main viewport and its simplified view on the minimap in another viewport using two different cameras.

In the main viewport the main AnimatedSprite node of objects should be rendered, and on the minimap there are only additional Sprite nodes of objects showing their schematic view.

I tried to do:

Node2D
-ViewportContainer
--ViewportMain
--- Camera2D
--- World
----Player
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
----OtherObjects
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
-ViewportContainer
--ViewportMinimap
--- Camera2D

In code I assign the main viewport's world to the minimap's viewport:

$ ViewportMinimap.world = $ ViewportMain.world

For the main AnimatedSprite I set Light Layer #1, for the sketchy Sprite I set Light Layer #2.

And it does not work.

Firstly, nothing is displayed on the minimap. I don’t understand how to make it work. How to tell the minimap's viewport to use the world from the main viewport?

Secondly, I can’t find anywhere how to set on the camera which Light Layer it has to display (in the three-dimensional Camera there is a Cull Layer parameter, but I don’t see it here).

Will this approach hit performance?

How to correctly implement a minimap without needing to modify it when you add new objects to the game?

How to correctly replace scenes when player moves from one to another if it's a child of the Viewport?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I solved it. Here is project with working solution: https://gamedev.ru/files/?id=146737

I should to use world_2d instead of world variable.

$ViewportMinimap.world_2d = $ViewportMain.world_2d
\$\endgroup\$
2
  • 5
    \$\begingroup\$ This answer would be better if it walked through the steps of your solution, rather than relying on an external link that can rot. \$\endgroup\$
    – DMGregory
    Commented Jun 17, 2020 at 10:36
  • \$\begingroup\$ Could you give even just an image of the code you used? It would really help me understand how to implement it. Thanks! \$\endgroup\$ Commented Jan 18, 2023 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .