In-Game Camera Control that Mimics Godot View Controls

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

First post, very (VERY!) new Godot user.

I need to have in-game 3D camera control that mimics the control found in Godot’s 3D editor view. So the user rotates, strafes, zooms, etc. using the same mouse methods as the ones in the editor.

Rotating an object is easy if it’s just using its own object space (or world space) for the rotation. But I’m at a loss how to make a camera translate the 2D screen space mouse movements to the active 3D camera.

This will be used as more as a 3D object viewer, as opposed to a “playable” game.

Any and all guidance, suggestions, or script snippets will be much appreciated!

:bust_in_silhouette: Reply From: Magso

Create a new action in the input map and do something like

var sensitivity : float

func _process(delta):
    if Input.is_action_pressed("new_action"):
        camera.translate(Vector3(Input.get_last_mouse_speed().x * sensitivity, Input.get_last_mouse_speed().y * sensitivity, 0))