I am trying to add controller support to a camera made by [Code with Tom][1]. It uses mouse input to move however I would like to be able to use a joystick. I tried doing so myself but with my limited knowledge of Godot especially 3D I can't get it to work. Thanks in advance.
Here is the code
extends KinematicBody
export(float, 0.1, 1) var mouse_sensitivity : float = 0.3
export(float, -90, 0) var min_pitch : float = -90
export(float, 0, 90) var max_pitch : float = 90
var velocity : Vector3
var y_velocity : float
onready var camera_pivot = $CameraPivot
onready var camera = $CameraPivot/CameraBoom/Camera
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _process(delta):
if Input.is_action_just_pressed("ui_cancel"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _input(event):
if event is InputEventMouseMotion:
rotation_degrees.y -= event.relative.x * mouse_sensitivity
camera_pivot.rotation_degrees.x -= event.relative.y * mouse_sensitivity
camera_pivot.rotation_degrees.x = clamp(camera_pivot.rotation_degrees.x, min_pitch, max_pitch)
[1]: https://www.youtube.com/channel/UCdU9e4eNsJif0rBrBiYRb5g