NEON-25: gdformat isometric_follow_camera.gd

pull/31/head
VinPropane 2026-04-08 00:08:00 -04:00
parent 387b61b577
commit 9f6297c46d
1 changed files with 6 additions and 8 deletions

View File

@ -74,9 +74,7 @@ func _process(delta: float) -> void:
if not allow_yaw: if not allow_yaw:
_orbit_yaw_rad = 0.0 _orbit_yaw_rad = 0.0
else: else:
_orbit_yaw_rad = clampf( _orbit_yaw_rad = clampf(_orbit_yaw_rad, -deg_to_rad(max_yaw_deg), deg_to_rad(max_yaw_deg))
_orbit_yaw_rad, -deg_to_rad(max_yaw_deg), deg_to_rad(max_yaw_deg)
)
var focus: Vector3 = target.global_position + Vector3(0.0, focus_vertical_offset, 0.0) var focus: Vector3 = target.global_position + Vector3(0.0, focus_vertical_offset, 0.0)
var yaw_total: float = deg_to_rad(presentation_yaw_deg) + _orbit_yaw_rad var yaw_total: float = deg_to_rad(presentation_yaw_deg) + _orbit_yaw_rad
@ -119,8 +117,10 @@ func _warn_missing_follow_target_once() -> void:
return return
_warned_missing_follow_target = true _warned_missing_follow_target = true
push_warning( push_warning(
"IsometricFollowCamera: follow_target_path is empty or does not resolve to a Node3D; " (
+ "camera not updating." "IsometricFollowCamera: follow_target_path is empty or does not resolve to a Node3D; "
+ "camera not updating."
)
) )
@ -128,6 +128,4 @@ static func desired_eye_world(
focus: Vector3, distance: float, pitch_elevation_rad: float, yaw_rad: float focus: Vector3, distance: float, pitch_elevation_rad: float, yaw_rad: float
) -> Vector3: ) -> Vector3:
var h: float = distance * cos(pitch_elevation_rad) var h: float = distance * cos(pitch_elevation_rad)
return focus + Vector3( return focus + Vector3(h * sin(yaw_rad), distance * sin(pitch_elevation_rad), h * cos(yaw_rad))
h * sin(yaw_rad), distance * sin(pitch_elevation_rad), h * cos(yaw_rad)
)