using System.Diagnostics; using System.Collections; using System.Collections.Generic; using System; using Godot; namespace Rokojori { [Tool] [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/VirtualCamera3D.svg") ] public partial class LookAtCamera:VirtualCamera3D { [Export] public Node3D target; [Export] public Smoothing smoothing; [Export] public TimeLine timeLine; public override void _Process( double delta ) { if ( Engine.IsEditorHint() ) { return; } var lookAtPosition = smoothing.Smooth( target.GlobalPosition, timeLine.delta ); if ( ! Math3D.IsValid( lookAtPosition ) ) { lookAtPosition = target.GlobalPosition; smoothing.SetCurrent( target.GlobalPosition ); } // this.LogInfo( target.GlobalPosition, lookAtPosition, timeLine.delta ); this.LookAt( lookAtPosition, Vector3.Up, true ); } } }