feat: stage simulation garden first read
This commit is contained in:
+19
-2
@@ -6,6 +6,7 @@ extends Node3D
|
||||
@export var follow_speed := 12.0
|
||||
@export var rotation_smooth_speed := 18.0
|
||||
@export var focus_smooth_speed := 14.0
|
||||
@export var pitch_degrees := -55.0
|
||||
|
||||
@export var mouse_sensitivity := 0.002
|
||||
|
||||
@@ -32,7 +33,7 @@ func _ready() -> void:
|
||||
if target:
|
||||
focus_position = target.global_position
|
||||
desired_focus_position = focus_position
|
||||
global_position = focus_position + min_zoom_offset.lerp(max_zoom_offset, zoom_smooth)
|
||||
_apply_camera_transform()
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
@@ -59,7 +60,7 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
smoothed_yaw = lerp_angle(smoothed_yaw, yaw, rot_t)
|
||||
|
||||
rotation = Vector3(deg_to_rad(-55), smoothed_yaw, 0)
|
||||
rotation = Vector3(deg_to_rad(pitch_degrees), smoothed_yaw, 0)
|
||||
|
||||
var target_pos := target.global_position
|
||||
var diff := target_pos - desired_focus_position
|
||||
@@ -89,3 +90,19 @@ func _physics_process(delta: float) -> void:
|
||||
var desired_position := focus_position + rotated_offset
|
||||
|
||||
global_position = global_position.lerp(desired_position, follow_t)
|
||||
|
||||
|
||||
func apply_presentation_preset(focus: Vector3, yaw_degrees: float, zoom_value: float) -> void:
|
||||
yaw = deg_to_rad(yaw_degrees)
|
||||
smoothed_yaw = yaw
|
||||
zoom = clampf(zoom_value, 0.0, 1.0)
|
||||
zoom_smooth = zoom
|
||||
focus_position = focus
|
||||
desired_focus_position = focus
|
||||
_apply_camera_transform()
|
||||
|
||||
|
||||
func _apply_camera_transform() -> void:
|
||||
rotation = Vector3(deg_to_rad(pitch_degrees), smoothed_yaw, 0)
|
||||
var active_offset := min_zoom_offset.lerp(max_zoom_offset, zoom_smooth)
|
||||
global_position = focus_position + active_offset.rotated(Vector3.UP, smoothed_yaw)
|
||||
|
||||
Reference in New Issue
Block a user