Skip to content

Commit

Permalink
Fix 360deg Rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
Snow1226 committed Apr 25, 2020
1 parent 72a7df8 commit d26fec6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
46 changes: 15 additions & 31 deletions CameraPlus/CameraPlusBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions CameraPlus/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
2 changes: 1 addition & 1 deletion CameraPlus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"gameVersion": "1.9.0",
"id": "CameraPlus",
"name": "CameraPlus",
"version": "4.1.0",
"version": "4.1.1",
"features": [],
"dependsOn": {
}
Expand Down

0 comments on commit d26fec6

Please sign in to comment.