From e5c8f4c380016a572b863670b8b17734e356f19a Mon Sep 17 00:00:00 2001 From: Glence Date: Sat, 1 Apr 2023 21:30:18 +0800 Subject: [PATCH] fix camera jittering --- Assets/Scripts/Gameplay/Player/SC_PlayerController.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index faf57b54..0b01dbaa 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -471,6 +471,9 @@ public class PlayerController : Script private void Gravity() { + if (currentState == RaccoonStates.CAUGHT) + return; + if (rb != null) { //check player vel.y if its close to zero its on the ground @@ -554,6 +557,7 @@ public class PlayerController : Script rb.ClearTorque(); rb.LinearVelocity = Vector3.Zero; rb.AngularVelocity = Vector3.Zero; + collider.GetCollisionShape(0).IsTrigger = true; } public void Reset() @@ -565,6 +569,7 @@ public class PlayerController : Script if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) stateMachine.SetState(typeof(PlayerIdleState)); + collider.GetCollisionShape(0).IsTrigger = false; tranform.GlobalPosition = respawnPoint.GetComponent().GlobalPosition; GameManager.Instance.RacoonCaught();