From e88bfc81af5c96939559e02690b78d5d0cb3b035 Mon Sep 17 00:00:00 2001 From: Josef Date: Sun, 16 Jun 2024 18:02:34 +0200 Subject: [PATCH] Virtual Camera Update --- Runtime/Logging/RJLog.cs | 10 ++++++- .../VirtualCameras/VirtualCamera3DManager.cs | 29 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Runtime/Logging/RJLog.cs b/Runtime/Logging/RJLog.cs index b158235..75eb009 100644 --- a/Runtime/Logging/RJLog.cs +++ b/Runtime/Logging/RJLog.cs @@ -18,7 +18,15 @@ namespace Rokojori return; } - if ( obj is float || obj is double ) + if ( obj is float ) + { + var floatValue = (float) obj; + var doubleValue = (double) floatValue; + output.Append( RegexUtility.WriteDouble( doubleValue ) ); + return; + } + + if ( obj is double ) { output.Append( RegexUtility.WriteDouble( (double)obj ) ); return; diff --git a/Runtime/VirtualCameras/VirtualCamera3DManager.cs b/Runtime/VirtualCameras/VirtualCamera3DManager.cs index 32b693c..8cc543b 100644 --- a/Runtime/VirtualCameras/VirtualCamera3DManager.cs +++ b/Runtime/VirtualCameras/VirtualCamera3DManager.cs @@ -18,8 +18,16 @@ namespace Rokojori [Export] public bool refreshSlots = false; + [Export] + public bool active = false; + public override void _Process( double delta ) { + if ( ! active ) + { + return; + } + LerpCameras( delta ); } @@ -66,7 +74,26 @@ namespace Rokojori c => { var priority = MathF.Max( 0, c.smoothedPriority ); - var rotation = c.camera.GetCameraRotation(); + var rotation = c.camera.GetCameraRotation(); + + if ( ! rotation.IsFinite() || rotation.Length() == 0 ) + { + rotation = new Quaternion(); + rotation.X = 0; + rotation.Y = 0; + rotation.Z = 0; + rotation.W = 1; + rotation = rotation.Normalized(); + //RJLog.Log( "Rotation was weird" ); + } + else + { + //RJLog.Log( "Rotation is fine" ); + } + + + + //RJLog.Log( rotation.X, rotation.Y, rotation.Z, rotation.W ); var vUp = rotation * Vector3.Up; var vForward = rotation * Vector3.Forward;