public bool IsInRegion(SpatialRegion reg)
 {
     foreach (SpatialRegion r in CollisionCheckRegion)
     {
         if (reg == r)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
        public void SimulateFrame(float timestep, ShaderUtility mShader)
        {
            foreach (Ball b in SpatialRegion.OverheadController_AllBalls)
            {
                b.vOldPosition = b.vPosition;
                PositionUpdate(b, timestep);

                CheckFor_SpherePlane_Collision(b);
            }
            SpatialRegion.SpatialPartitioningController();
            foreach (SpatialRegion space in SpatialRegion.AllRegions)
            {
                space.DoCollisionChecks(); //Each Spatial Segment Handles it's own collision detection calls.
            }
            //Remove dead objects from simlation. Go on Garbage Collector, do your thing.
            while (cleanupList.Count > 0)
            {
                cleanupList[0].KillRegions();
                SpatialRegion.OverheadController_AllBalls.Remove(cleanupList[0]);
                cleanupList.Remove(cleanupList[0]);
            }
        }