BEPUphysics.NarrowPhaseSystems.NarrowPhaseHelper.GetPairHandler C# (CSharp) Method

GetPairHandler() public static method

Gets a collidable pair handler for a pair of collidables.
public static GetPairHandler ( CollidablePair &pair ) : CollidablePairHandler
pair CollidablePair Pair of collidables to use to create the pair handler.
return BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler
        public static CollidablePairHandler GetPairHandler(ref CollidablePair pair)
        {
            var overlap = new BroadPhaseOverlap(pair.collidableA, pair.collidableB);
            return GetPairHandler(ref overlap) as CollidablePairHandler;
        }

Same methods

NarrowPhaseHelper::GetPairHandler ( CollidablePair &pair, CollisionRule rule ) : CollidablePairHandler
NarrowPhaseHelper::GetPairHandler ( BEPUphysics.BroadPhaseSystems.BroadPhaseEntry entryA, BEPUphysics.BroadPhaseSystems.BroadPhaseEntry entryB ) : BEPUphysics.NarrowPhaseSystems.Pairs.NarrowPhasePair
NarrowPhaseHelper::GetPairHandler ( BEPUphysics.BroadPhaseSystems.BroadPhaseEntry entryA, BEPUphysics.BroadPhaseSystems.BroadPhaseEntry entryB, CollisionRule rule ) : BEPUphysics.NarrowPhaseSystems.Pairs.NarrowPhasePair
NarrowPhaseHelper::GetPairHandler ( BroadPhaseOverlap &pair ) : BEPUphysics.NarrowPhaseSystems.Pairs.NarrowPhasePair

Usage Example

Beispiel #1
0
        void UpdateBroadPhaseOverlap(int i)
        {
            BroadPhaseOverlap overlap = broadPhaseOverlaps.Elements[i];

            if (overlap.collisionRule < CollisionRule.NoNarrowPhasePair)
            {
                NarrowPhasePair pair;
                //see if the overlap is already present in the narrow phase.
                if (!overlapMapping.TryGetValue(overlap, out pair))
                {
                    //Create/enqueue based on collision table
                    pair = NarrowPhaseHelper.GetPairHandler(ref overlap);
                    if (pair != null)
                    {
                        pair.NarrowPhase = this;
                        //Add the new object to the 'todo' list.
                        //Technically, this doesn't need to be thread-safe when this is called from the sequential context.
                        //It's just bunched together for maintainability despite the slight performance hit.
                        newNarrowPhasePairs.Enqueue(pair);
                    }
                }
                if (pair != null)
                {
                    //Update the collision rule.
                    pair.CollisionRule = overlap.collisionRule;
                    if (pair.BroadPhaseOverlap.collisionRule < CollisionRule.NoNarrowPhaseUpdate)
                    {
                        pair.UpdateCollision(TimeStepSettings.TimeStepDuration);
                    }
                    pair.NeedsUpdate = false;
                }
            }
        }