static void Init(RaySegmentsCollisionInfo[] info)
 {
     for (int index = 0; index < info.Length; ++index)
     {
         info[index] = new RaySegmentsCollisionInfo();
     }
 }
Exemple #2
0
 static void Init(RaySegmentsCollisionInfo[] info)
 {
     for (int index = 0; index < info.Length; ++index)
     {
         info[index] = new RaySegmentsCollisionInfo();
     }
 }
 static void Reset(RaySegmentsCollisionInfo[] info)
 {
     for (int index = 0; index < info.Length; ++index)
     {
         info[index].distance = -1;
         info[index].body = null;
     }
 }
Exemple #4
0
        void OnCollided(object sender, CollisionEventArgs e)
        {
            RaySegmentIntersectionInfo info = e.CustomCollisionInfo as RaySegmentIntersectionInfo;

            if (info != null)
            {
                ReadOnlyCollection <Scalar> distances = info.Distances;

                for (int index = 0; index < next.Length; ++index)
                {
                    RaySegmentsCollisionInfo cinfo = next[index];
                    if (distances[index] != -1 && (cinfo.distance == -1 || distances[index] < cinfo.distance))
                    {
                        cinfo.body     = e.Other;
                        cinfo.distance = distances[index];
                    }
                }
            }
        }