Exemple #1
0
        private static List <ContactPoint> NarrowPhase(Memory <CollidablePair> pairs)
        {
            List <ContactPoint>   contacts = new List <ContactPoint>();
            Span <CollidablePair> pa       = pairs.Span;

            for (int i = 0; i < pa.Length; i++)
            {
                RigidbodyHandle a = (RigidbodyHandle)pa[i].a;
                RigidbodyHandle b = (RigidbodyHandle)pa[i].b;
                if (a.GetBound().IsColliding(a.state[0].transform, b.state[0].transform, b.GetBound()).Length > 0)
                {
                    contacts.AddRange(a.shape.IsColliding(a.state[0].transform, b.state[0].transform, b.shape));
                }
            }
            return(contacts);
        }