summaryrefslogtreecommitdiff
path: root/camera.gd
blob: 4a14865846124df7be261aa70a343e9a9820d3d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class_name FreeCamera
extends Camera3D


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if Input.is_action_pressed("camera_move"):
		if Input.is_key_pressed(KEY_SHIFT):
			rotate_y(delta)
		else:
			rotate_y(-delta)
	
	if Input.is_action_just_released("camera_zoom_out"):
		global_position -= project_ray_normal(get_viewport().get_mouse_position())
	elif Input.is_action_just_released("camera_zoom_in"):
		global_position += project_ray_normal(get_viewport().get_mouse_position())