public void Update() { AABB a; for (int i = 0; i < collisions.Count; i++) { if (CollisionChecker.AreColliding(collisions[i].c1, collisions[i].c2, out a)) { collisions[i].c1.InvokeColliding(collisions[i]); collisions[i].c2.InvokeColliding(collisions[i]); collisions[i].intersection = a; } else { collisions[i].c1.InvokeCollisionEnded(collisions[i]); collisions[i].c2.InvokeCollisionEnded(collisions[i]); if (onCollidionEnded != null) { onCollidionEnded.Invoke(collisions[i]); } collisions.RemoveAt(i); i--; } } }
public void OnColliderMoved(Collider c) { AABB a; for (int i = 0; i < colliders.Count; i++) { if (colliders[i] != c && ColliderGroupManager.CanCollide(c.Group, colliders[i].Group) && c.ShouldCheckForCollision(colliders[i])) { if (CollisionChecker.AreColliding(c, colliders[i], out a)) { RegisterCollision(c, colliders[i], a); } } } }