Home

Awesome

Camera Control Script

An easy "plug and play" camera script for the godot engine 3 that provides controls like freelook(mouselook), movement and an optional ingame control gui. Useful for development and quick tests.

Features:

Preview:

Demo video: https://www.youtube.com/watch?v=OSJRc-IiOio&t=9s

<details> <summary>Editor Settings</summary> <img src="assets/maujoe.camera_control/screenshots/editor_settings.png" > </details> <details> <summary>Ingame Gui</summary> <img src="assets/maujoe.camera_control/screenshots/ingame_gui.png" > </details>

How to use

There is a demo scene in the demo folder where you can test all features and play with the script settings.

If you don't need the demo just ignore the demo folder and connect your camera with the "camera_control.gd" script that can be found in the script folder.

Add events to InputMap actions

Here is an example to add WASD movements programatically, assuming the camera node name is Camera:

func setup_camera():
	set_action($Camera.forward_action, Config.key_move_forward)
	set_action($Camera.backward_action, Config.key_move_backward)
	...
	return

func set_action(action: String, config_key: String):
	var input_event := InputEventKey.new()
	input_event.scancode = OS.find_scancode_from_string(config_key)
	InputMap.action_add_event(action, input_event)

This logic can be used to load key bindings from a configuration file.

Docummentation:

Settings available via Editor/GDscript:

General

Freelook

Pivot

Movement

Input Actions / Controls

Freelook
Movement

Ingame Gui

Gui configuration:

The ingame gui can also be configurated via constants in the camera_control_gui.gd script

Image

License

MIT License - see the LICENSE.md file for details. Please keep license file, thanks. :)