protected void TryToAdd(int index)
        {
            var entry = new TriangleEntry {
                Index = index
            };

            if (!subPairs.ContainsKey(entry))
            {
                var collidablePair = new CollidablePair(CollidableA, entry.Collidable = GetOpposingCollidable(index));
                var newPair        = (MobileMeshPairHandler)NarrowPhaseHelper.GetPairHandler(ref collidablePair);
                if (newPair != null)
                {
                    newPair.CollisionRule = CollisionRule;
                    newPair.UpdateMaterialProperties(MaterialA, MaterialB);  //Override the materials, if necessary.  Meshes don't currently support custom materials but..
                    newPair.Parent = this;
                    subPairs.Add(entry, newPair);
                }
            }
            containedPairs.Add(entry);
        }
Beispiel #2
0
 protected override void ConfigureCollidable(TriangleEntry entry, float dt)
 {
 }
 /// <summary>
 /// Configure a triangle from CollidableB to represent the object at the given index.
 /// </summary>
 /// <param name="entry">Entry to configure.</param>
 /// <param name="dt">Time step duration.</param>
 protected abstract void ConfigureCollidable(TriangleEntry entry, float dt);