Ejemplo n.º 1
0
        void ICCDPositionUpdateable.UpdateTimesOfImpact(float dt)
        {
            //I am a continuous object.  If I am in a pair with another object, even if I am inactive,
            //I must order the pairs to compute a time of impact.

            //The pair method works in such a way that, when this method is run asynchronously, there will be no race conditions.
            for (int i = 0; i < collisionInformation.pairs.Count; i++)
            {
                //Only perform CCD if we're either supposed to test against no solver pairs or if this isn't a no solver pair.
                if (MotionSettings.CCDFilter(collisionInformation.pairs.Elements[i]))
                    collisionInformation.pairs.Elements[i].UpdateTimeOfImpact(collisionInformation, dt);
            }
        }
Ejemplo n.º 2
0
 ///<summary>
 /// Updates the time of impact for the pair.
 ///</summary>
 ///<param name="requester">Collidable requesting the update.</param>
 ///<param name="dt">Timestep duration.</param>
 public override void UpdateTimeOfImpact(Collidable requester, float dt)
 {
     timeOfImpact = 1;
     foreach (CollidablePairHandler pair in subPairs.Values)
     {
         //The system uses the identity of the requester to determine if it needs to do handle the TOI calculation.
         //Use the child pair's own entries as a proxy.
         if (MotionSettings.CCDFilter(pair))
         {
             if (BroadPhaseOverlap.entryA == requester)
             {
                 pair.UpdateTimeOfImpact((Collidable)pair.BroadPhaseOverlap.entryA, dt);
             }
             else
             {
                 pair.UpdateTimeOfImpact((Collidable)pair.BroadPhaseOverlap.entryB, dt);
             }
             if (pair.timeOfImpact < timeOfImpact)
             {
                 timeOfImpact = pair.timeOfImpact;
             }
         }
     }
 }