Make 2D Overlay Ignored by Camera2D
Asked Answered
H

4

0


The objective is to get symbols scrolling on the sides to maintain size and position, ignoring Camera2D and Light2D. Failed with CanvasLayer and SubViewport. Feels like I'm missing something obvious 🤔

Hern answered 16/3 at 4:14 Comment(0)
P
0

CanvasLayer should work. At least it did for me. Just make sure that under "Layer" you put it on a layer above 0 (that's where your camera and all your regular nodes live, if you don't explicitly put them into a CanvasLayer of their own).

Pine answered 16/3 at 8:50 Comment(0)
H
0

Pine Hey thanks for the reply!
Using the CanvasLayer solves the light issue, but it's children are still affected by the Camera2D zoom. Is there any way to prevent that?

Hern answered 18/3 at 17:15 Comment(0)
P
0

Hern Yes. Make sure the camera is not in the UI CanvasLayer.

Node2D
- AnotherNode2D for everything that's effected by your zoom
  - Camera2D
- CanvasLayer for UI
  - all your UI nodes

There's an explanation here:
https://docs.godotengine.org/en/stable/tutorials/2d/canvas_layers.html

Pine answered 19/3 at 7:34 Comment(0)
H
0

Pine

I have this setup, but the Camera2D is still affecting my Sprite2Ds. I tried a TextureRect but still got the same results. This is incredibly frustrating 😅

EDIT: I just noticed I had "Follow Viewport" on! Turning it off made the sprites disappear, but the docs say the following so I'm hopeful:

"If enabled, the CanvasLayer will use the viewport's transform, so it will move when camera moves instead of being anchored in a fixed position on the screen."

SOLUTION: Scaled the CanvasLayer down to 0.1 and set the Offset to half my target resolution (full-HD)! Thank you for pointing me in the right direction Pine!

Hern answered 19/3 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.