Unlocking the mouse cursor so it can be used to interact with a 2D element in a 3D scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cameron Kilgore
:warning: Old Version Published before Godot 3 was released.

I have a 3D scene that uses the mouse cursor to control the camera, and there is a circumstance where I would like to permit the mouse to be used when I have a 2D component (in this case, a future world map) when its displayed on screen via hide/show toggle. What’s the best approach to accomplishing this?

The 3D context taking the current mouse usage is a KinematicBody object, via the following calls in _ready():


This method is based on the 3rdperson-godot project, and the 2d context is just a Panel.

The best solution involves unlocking the mouse using Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) Input — Godot Engine (latest) documentation in English
I don’t know how the 3rdperson-godot is setup, but FPS locking is basically done using this function.
You probably need to do more than that though, because even when unlocked the mouse might still control the camera.

Zylann | 2017-06-28 13:03