Godot Version
4.7
Question
I’m working on a 3d editor plugin so that I can navigate around the spherical planets in my game more easily while in editor and I’m struggling to find if there’s a way to disable Godot’s control over the editor 3d viewport camera. I can set the Transform3D of the camera just fine, but the editor always applies limits to the transform to lock the camera from looking upside down, which is what I need..
For example, if this were run as a plugin, it will pan the camera when a node is selected and the mouse is moved inside the editor’s 3d viewport:
@tool
extends EditorPlugin
func _forward_3d_gui_input(camera:Camera3D, event:InputEvent):
if event is InputEventMouse:
camera.rotate_object_local(Vector3.UP, event.relative.x * 0.01)
return EditorPlugin.AFTER_GUI_INPUT_STOP
func _handles(object: Object) -> bool:
return true
But, if “Vector3.UP” is replaced with “Vector3.FORWARD”, which should roll the camera instead, the camera will just not rotate at all, I assume this is because the editor is correcting that roll.
I’ve been digging through godot’s pull requests and here it seems like they added support for controlling the camera in plugins and tool scripts but I can’t figure out how to disable these limits applied to the camera even after modifying the camera’s transform.
Any suggestions would be super appreciated!