Ejemplo n.º 1
0
        public static ProximityDetector makeSphere(SpatialVectorDouble center, double radius, bool handleParticles = false)
        {
            ProximityDetector detector = new ProximityDetector(EnumShapeType.SPHERE, center, new SpatialVectorDouble(new double[] { radius }));

            detector.cachedKDop      = KDopUtilities.makeAabbKDopByCenterAndRadius(center, radius);
            detector.handleParticles = handleParticles;
            return(detector);
        }
Ejemplo n.º 2
0
        public void addProximityDetector(ProximityDetector detector)
        {
            // make sure the bounding volumes are up to date
            // PERFORMANCE< we recalc the bounding volumes for bounding volume "dirty" objects to save some cycles >
            transformOnlyDirtyObjects();
            recalcBoundingVolumesForDirtyObjects();

            // do this to add all objects and particles which overlap
            IEnumerable <ProximityDetector> listOfOneProximityDetector = new ProximityDetector[] { detector };

            ProximityHelper.checkProximityDetectorsAndFireEventsForParticles(listOfOneProximityDetector, particles);
            ProximityHelper.checkProximityDetectorsAndFireEventsForObjects(listOfOneProximityDetector, physicsAndMeshPairs.Select(v => v.physicsComponent));

            privateProximityDetectors.Add(detector);
        }
Ejemplo n.º 3
0
 static bool checkParticleOverlap(ProximityDetector detector, PhysicsComponent particle)
 {
     return(detector.cachedKDop.checkIntersectPosition(particle.position));
 }
Ejemplo n.º 4
0
 static bool checkObjectOverlap(ProximityDetector detector, PhysicsComponent object_)
 {
     return(!KDop.checkIntersectAabb(object_.boundingVolume.kdop, detector.cachedKDop));
 }
Ejemplo n.º 5
0
 static bool checkParticleExitingExitOfObject(ProximityDetector detector, PhysicsComponent particle)
 {
     return(!detector.cachedKDop.checkIntersectPosition(particle.position));
 }
Ejemplo n.º 6
0
        public void removeProximityDetector(ProximityDetector detector)
        {
            // TODO< fire EXIT event for all contained objects and particles >

            privateProximityDetectors.Remove(detector);
        }