2D Security camera system

Godot Version

4.2

Question

Hello guys!

I try to implement a “security camera system” that the player can check to make choices in his gameplay.
Very easy to do in a 3D project with that SceneTree setup :

  • SubViewport node
    • Camera3D childnode
  • Sprite3D node (with Texture set to “ViewportTexture” and connected to the above SubViewport.)

And thats it, the Sprite receive live texture from the Camera3D childnode of the above SubViewport, creating a literal “real life camera” in your scene.

BUT… that kind of setup dont work on 2D project, wich i’m in. So after reading back and forth documentation and trying weiiiird stuff all over the place,
i wonder if someone know the trick in 2D to get whatever an “outside-of-a-player camera” sees for displaying it somewhere else ?

Maybe working with Camera2D isn’t ideal to achieve this trick in a 2D setup ? I try harded in this way because it felt natural to me but i couldn’t figure it out.

If someone have an idea, or a starting point, or even a blurry direction it would help me a lot ^^

CanvasLayer is what I used

Okay so you use CanvasLayer to setup your “camera displays” i get it, but how do you actually get the image/texture data from the Camera ?
It looks like your acheive to display that data from the Camera into your Control BLOCKS and WALL sprites, that’s exactlly what i try to do.

what i would do is create a CanvasLayer in the editor, throw some test nodes in it (sprites, color rects) and test it out. you can also search YouTube for ‘godot canvaslayer’ and where are videos that explain it in detail.

https://www.youtube.com/results?search_query=godot+canvaslayer

1 Like