fix camera jittering

This commit is contained in:
Glence 2023-04-01 21:30:18 +08:00
parent f114a7f59a
commit e5c8f4c380
1 changed files with 5 additions and 0 deletions

View File

@ -471,6 +471,9 @@ public class PlayerController : Script
private void Gravity() private void Gravity()
{ {
if (currentState == RaccoonStates.CAUGHT)
return;
if (rb != null) if (rb != null)
{ {
//check player vel.y if its close to zero its on the ground //check player vel.y if its close to zero its on the ground
@ -554,6 +557,7 @@ public class PlayerController : Script
rb.ClearTorque(); rb.ClearTorque();
rb.LinearVelocity = Vector3.Zero; rb.LinearVelocity = Vector3.Zero;
rb.AngularVelocity = Vector3.Zero; rb.AngularVelocity = Vector3.Zero;
collider.GetCollisionShape(0).IsTrigger = true;
} }
public void Reset() public void Reset()
@ -565,6 +569,7 @@ public class PlayerController : Script
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(PlayerIdleState)); stateMachine.SetState(typeof(PlayerIdleState));
collider.GetCollisionShape(0).IsTrigger = false;
tranform.GlobalPosition = respawnPoint.GetComponent<Transform>().GlobalPosition; tranform.GlobalPosition = respawnPoint.GetComponent<Transform>().GlobalPosition;
GameManager.Instance.RacoonCaught(); GameManager.Instance.RacoonCaught();