The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

In my 2D main-scene i instanced the 3d game-scene.
than i instanced the level-scene in the game-scene through script-code and the player-scene in the level-scene the same way.

I need this setup to display two cameras at once, which use sprites as screens.
than the levels are instances to switch easily from one to another and the player is an instance to need only one player-scene for the whole game.

i tried


the first three names in this line are the variables, in which each instance is stored in the script of their parent-scenes.



Everything, that uses grid calculations, is child of the GridMap-node "Walls" in the level-scene, that provides all grid-calculations in it´s script.

First variant gives an invalidgetindex - error.
Second variant gives a callfunctiongetviewportatnullindex - error.

how can i now access the player scene in the main scene?

It´s because i want to play the view of the player-cam on a sprite in the 2D-main-scene.

Now i think, maybe the call for finding the camera runs faster, than the nested instance-steps are done.

So i thaught, maybe i can let the player emmit a custom signal at the end of it´s ready-function.

But how do i now connect the signal to the 2D-main-scene?

Godot version v3.4.3
in Engine by (75 points)
retagged by

1 Answer

0 votes

never mind

i now found a way my self:

I took the first person camera and viewport out of the player and into the game-scene, where the topdown-stuff already is Than i made the player call a function for the camere in process, that sets position and rotation of the camera to the values of the player.

so i could connect both cameras exact the same way to their matching sprite-screens.

now everything is correct placed: fitted gamescreen

by (75 points)
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.