From d26fec6da85d84d3b56c42a98199f49609bca235 Mon Sep 17 00:00:00 2001 From: Snow1226 Date: Sun, 26 Apr 2020 02:43:43 +0900 Subject: [PATCH] Fix 360deg Rotate --- CameraPlus/CameraPlusBehaviour.cs | 46 +++++++++------------------ CameraPlus/Properties/AssemblyInfo.cs | 4 +-- CameraPlus/manifest.json | 2 +- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/CameraPlus/CameraPlusBehaviour.cs b/CameraPlus/CameraPlusBehaviour.cs index cc66a7c..c19d594 100644 --- a/CameraPlus/CameraPlusBehaviour.cs +++ b/CameraPlus/CameraPlusBehaviour.cs @@ -415,45 +415,29 @@ protected virtual void LateUpdate() private void HandleThirdPerson360() { - if (!_beatLineManager || !Config.use360Camera || !_environmentSpawnRotation) return; - float a; float b; - if (Config.cam360RotateControlNew) + if (_beatLineManager.isMidRotationValid) { - if (_beatLineManager.isMidRotationValid) - { - - a = Mathf.LerpAngle(ThirdPersonRot.y, this._beatLineManager.midRotation, Mathf.Clamp(Time.deltaTime * Config.cam360Smoothness, 0f, 1f)); - b = Mathf.LerpAngle(ThirdPersonRot.y, this._environmentSpawnRotation.targetRotation, Mathf.Clamp(Time.deltaTime * Config.cam360Smoothness, 0f, 1f)); - - if (a < b) - _yAngle = a; - else - _yAngle = b; - } - + double midRotation = (double)this._beatLineManager.midRotation; + float num1 = Mathf.DeltaAngle((float)midRotation, this._environmentSpawnRotation.targetRotation); + float num2 = (float)(-(double)this._beatLineManager.rotationRange * 0.5); + float num3 = this._beatLineManager.rotationRange * 0.5f; + if ((double)num1 > (double)num3) + num3 = num1; + else if ((double)num1 < (double)num2) + num2 = num1; + b = (float)(midRotation + ((double)num2 + (double)num3) * 0.5); } else - { - if (_beatLineManager.isMidRotationValid) - { - double midRotation = (double)this._beatLineManager.midRotation; - float num1 = Mathf.DeltaAngle((float)midRotation, this._environmentSpawnRotation.targetRotation); - float num2 = (float)(-(double)this._beatLineManager.rotationRange * 0.5); - float num3 = this._beatLineManager.rotationRange * 0.5f; - if ((double)num1 > (double)num3) - num3 = num1; - else if ((double)num1 < (double)num2) - num2 = num1; - b = (float)(midRotation + ((double)num2 + (double)num3) * 0.5); - } - else - b = this._environmentSpawnRotation.targetRotation; + b = this._environmentSpawnRotation.targetRotation; + if (Config.cam360RotateControlNew) + _yAngle = Mathf.LerpAngle(_yAngle, b, Mathf.Clamp(Time.deltaTime * Config.cam360Smoothness, 0f, 1f)); + else _yAngle = Mathf.Lerp(_yAngle, b, Mathf.Clamp(Time.deltaTime * Config.cam360Smoothness, 0f, 1f)); - } + ThirdPersonRot = new Vector3(Config.cam360XTilt, _yAngle + Config.cam360YTilt, Config.cam360ZTilt); ThirdPersonPos = (transform.forward * Config.cam360ForwardOffset) + (transform.right * Config.cam360RightOffset); diff --git a/CameraPlus/Properties/AssemblyInfo.cs b/CameraPlus/Properties/AssemblyInfo.cs index 688110a..4ea3415 100644 --- a/CameraPlus/Properties/AssemblyInfo.cs +++ b/CameraPlus/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.1.0")] -[assembly: AssemblyFileVersion("4.1.0")] +[assembly: AssemblyVersion("4.1.1")] +[assembly: AssemblyFileVersion("4.1.1")] diff --git a/CameraPlus/manifest.json b/CameraPlus/manifest.json index 3f04749..edac51e 100644 --- a/CameraPlus/manifest.json +++ b/CameraPlus/manifest.json @@ -5,7 +5,7 @@ "gameVersion": "1.9.0", "id": "CameraPlus", "name": "CameraPlus", - "version": "4.1.0", + "version": "4.1.1", "features": [], "dependsOn": { }