root/ClippedCamera.gd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extends ClippedCamera

var focus = null
const UP = Vector3(0,1,0)

func _ready():
	pass # Replace with function body.

func set_focus(focus_arg):
	focus = focus_arg

func _process(_delta):
	if focus:
		look_at(focus.transform.origin, UP)

func _input(event):
	if event is InputEventScreenDrag:
		get_parent().unit_offset -= event.relative.x / 360.0
	elif event is InputEventMouseMotion and Input.is_mouse_button_pressed(1):
		get_parent().unit_offset -= event.relative.x / 360.0