+1 vote

The second day I google the tutorials, but nothing comes of it. All tutorials link to splitscreen demo, but it is made under the second Godot and does not work in the third.

The problem is this: 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 node of objects with their schematic view.

Tried to do so:

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 main viewport's world to 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 minimap's viewport to use the world from main viewport?

Secondly, I can’t find anywhere how to set 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 minimap without need to modify it when you add new object to game?

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

in Engine by (274 points)

1 Answer

0 votes
Best answer

You asked multiple questions, here is my 2 cents for the first one:

If you didn't change OwnWorld property of ViewportMain you should probably use world_2d instead world, i.e.:

$ViewportMinimap.world_2d = $ViewportMain.world_2d

world property is for 3D, world_2d is for 2D.

by (46 points)
selected by

Yes, you are right. Here is working project: https://gamedev.ru/files/?id=146737

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.