private void UpdatePhysics() { ProfilerShort.Begin("Update Physics Sectors"); BoundingBoxD box = Planet.PositionComp.WorldAABB; box.Min -= MyPlanet.PHYSICS_SECTOR_SIZE_METERS; box.Max += MyPlanet.PHYSICS_SECTOR_SIZE_METERS; m_sectorBoxes.Clear(); MyGamePruningStructure.GetAproximateDynamicClustersForSize(ref box, EnvironmentDefinition.SectorSize / 2, m_sectorBoxes); foreach (var cell in m_sectorBoxes) { var c = cell; c.Translate(-PlanetTranslation); c.Inflate(EnvironmentDefinition.SectorSize / 2); var position = c.Center; double distance = position.Length(); double inflate = c.Size.Length() / 2; if (distance >= Planet.MinimumRadius - inflate && distance <= Planet.MaximumRadius + inflate) { RasterSectorsForPhysics(c); } } ProfilerShort.End(); }