add lots of stuff
This commit is contained in:
15
scripts/camera/following_camera.gd
Normal file
15
scripts/camera/following_camera.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
class_name FollowingCamera
|
||||
extends Camera3D
|
||||
|
||||
@export var height_offset: float = 0.4
|
||||
@export var distance: float = 6
|
||||
@export var angle_degrees: Vector3
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var follow_position := (
|
||||
Referencer.player.global_position + Vector3.UP * height_offset
|
||||
)
|
||||
|
||||
global_rotation_degrees = angle_degrees
|
||||
global_position = follow_position + transform.basis.z * distance
|
||||
20
scripts/camera/main_camera.gd
Normal file
20
scripts/camera/main_camera.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
class_name MainCamera
|
||||
extends Camera3D
|
||||
|
||||
@export var current_camera: Camera3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Referencer.main_camera = self
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
global_position = current_camera.global_position
|
||||
global_rotation = current_camera.global_rotation
|
||||
fov = current_camera.fov
|
||||
near = current_camera.near
|
||||
far = current_camera.far
|
||||
|
||||
|
||||
func is_camera_current(camera: Camera3D) -> bool:
|
||||
return current_camera == camera
|
||||
Reference in New Issue
Block a user