-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.6] get_viewport().get_camera() doesn't work in editor #77661
Comments
Have you tried to call Camera.make_current()? I rember having to do that when I had to do some off-screen viewport rendering in an editor tool script. |
The node is running in the 3D view so it should grab the 3D view camera |
Don't think it's safe to assume the editor camera to be the camera attached to the viewport of the node |
The 3D editor can show up to four viewports at the same time, and each viewport has its own camera, so I don't think this is supposed to work. |
There are 4 editor cameras. They exist in a different place in the tree than the rest of your scene, but they do exist. You can either search the tree for Camera3Ds, or you can use the editorplugin route, as demonstrated by EditorFlyCam https://github.com/Schroedi/EditorFlyCam/blob/main/addons/EditorFlyCam/efc_plugin.gd Several people already demonstrated how to find the editor cameras in 3.x and 4.x. You participated in this thread. The best solution though is to get the core dev team to finally relent and expose the editor cameras, by accepting any of the several PRs that have been provided. |
This is a slightly different usecase because I think the behaviour in editor should be the same as in-game without any extra plugin or separate calls. I need to get camera information so that I can do rendering. I need the same transform that gets passed to shaders, yet it's somehow unavailable. I don't need to manipulate the editor camera here, only read from it. Reading is easier than writing because it affects way less existing systems. |
It sounds like there should be a dedicated method for that through EditorInterface, like #68706 did for the 2D editor. That said, this is proposal territory as I don't think |
Billboarding works though. I am generating immediate geometry and i need the camera vectors to do that. |
Billboarding is done in the shader IIRC, so the camera vector is different for each viewport. If it's done via immediate geometry, it can only face one camera. |
I'd still take that over not being able to test it in editor at all |
Godot version
3.6 (custom build)
System information
Fedora, RX 590
Issue description
I am trying to use immediate geometry and force the geometry to draw in a billboard mode.
I am not able to do
get_viewport().get_camera()
in editor, so i can't preview the billboard mode in editorSteps to reproduce
print(get_viewport().get_camera())
on a tool script.Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: