/// <summary> /// Removes and returns the old child shape associated with the given prim /// </summary> /// <param name="physxPrim">The child prim</param> /// <returns>The old shape</returns> private PhysicsShape RemoveChildShape(PhysxPrim physxPrim) { PhysicsShape retShape = null; RelatedShapes childShapes; if (_childShapes.TryGetValue(physxPrim, out childShapes)) { physxPrim.ClearTrackedTouches(); _scene.ForEachCharacter((PhysxCharacter character) => { character.InvalidateControllerCacheIfContacting(this); } ); retShape = childShapes.ChildShape; foreach (PhysX.Shape shape in childShapes.PhyShapes) { shape.Dispose(); _shapeToPrimIndex.Remove(shape); } _childShapes.Remove(physxPrim); //collision accounting if (physxPrim._properties.WantsCollisionNotification) { if (--_numChildPrimsWantingCollisionNotification == 0) { _properties.ChildrenWantCollisionNotification = false; } } } return retShape; }