Get 2D editor's camera

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hubber116sx

I’m creating a plugin for the Godot Engine and I need the editor’s 2D camera for a feature I plan to add. There is a virtual function, forward_ spatial_ gui_ input, that can get the editor’s camera in 3D space, although the 2D equivialent of this funciton, forward_ canvas_ gui_ input, doesn’t give the 2D editor’s camera. Is there some other way to get the 2D camera of the editor?

Thanks! This was exactly what I needed!

Hubber116sx | 2018-09-23 21:55

Then I’ll put it as an answer.
Up vote and select ;D

SIsilicon | 2018-09-24 00:13

:bust_in_silhouette: Reply From: SIsilicon

You know technically the 2D environment of Godot doesn’t use a Camera2D. After all. Camera2D is really just a helper node to allow manipulating the scene’s viewport’s canvas transform in a more intuitive way. If you just want the scene’s canvas transform then call this from a CanvasItem.

get_viewport().get_canvas_transform()