Add check for disappeared colliders

This commit is contained in:
Pascal Serrarens 2023-04-14 10:32:03 +02:00
parent 178d242762
commit 3d340c4312

View File

@ -90,7 +90,7 @@ namespace Passer {
} }
virtual protected void UpdateKinematicRigidbody() { virtual protected void UpdateKinematicRigidbody() {
if (mode == PhysicsMode.NonKinematic || if (mode == PhysicsMode.NonKinematic ||
thisRigidbody.mass > kinematicMass || thisRigidbody.mass > kinematicMass ||
thisRigidbody.GetComponent<Joint>() != null thisRigidbody.GetComponent<Joint>() != null
) { ) {
@ -183,7 +183,7 @@ namespace Passer {
// The sweeptests fail quite often... // The sweeptests fail quite often...
//RaycastHit hit; //RaycastHit hit;
//if (!thisRigidbody.SweepTest(target.transform.position - thisRigidbody.position, out hit)) //if (!thisRigidbody.SweepTest(target.transform.position - thisRigidbody.position, out hit))
hasCollided = false; hasCollided = false;
} }
} }
@ -581,8 +581,10 @@ namespace Passer {
if (colliders == null) if (colliders == null)
return; return;
foreach (Collider c in colliders) foreach (Collider c in colliders) {
c.isTrigger = false; if (c != null)
c.isTrigger = false;
}
} }
/// <summary> /// <summary>
@ -597,8 +599,10 @@ namespace Passer {
if (colliders == null) if (colliders == null)
return; return;
foreach (Collider c in colliders) foreach (Collider c in colliders) {
c.isTrigger = false; if (c != null)
c.isTrigger = false;
}
} }
#endregion #endregion