void ComputeLandingHeightsOld() { float fromZ = MaxZ + 10; float StepSize = PathStore.StepSize; //0.2f int MAPSPACE = PathStore.MAPSPACE; int MAPSPACE1 = MAPSPACE - 1; // 1279 bool needsInit = false; float[,] _HeightMap = HeightMap; if (LandingHieghts == null) { if (_HeightMap != null) { LandingHieghts = (float[, ])_HeightMap.Clone(); } else { LandingHieghts = new float[MAPSPACE, MAPSPACE]; needsInit = true; } } CollisionIndex[,] MeshIndex = PathStore.MeshIndex; // FallingPrims = new FallingPrim[MAPSPACE, MAPSPACE]; float fy = 256.1f; OdeScene ps = PathStore.odeScene; fallingPrims = 0; for (int y = MAPSPACE1; y >= 0; y--) { fy = fy - StepSize; float fx = 256.1f; for (int x = MAPSPACE1; x >= 0; x--) { fx = fx - StepSize; if (needsInit) { LandingHieghts[x, y] = float.MinValue; } if (MeshIndex[x, y] == null) { continue; } //FallingPrims[x, y] = new FallingPrim(ps, this, new PhysicsVector(fx, fy, fromZ), x, y, 0f); fallingPrims++; } int MaxTries = 100; while (fallingPrims > 0 && MaxTries-- > 0) { // CollisionPlane.Debug("fallingPrims=" + fallingPrims); ps.Simulate(0.133f); } //CollisionPlane.Debug("fallingPrims left over {0} MaxTries Left over = {1}", fallingPrims, MaxTries); ps.Simulate(0.133f); // for removal of remainders or not needed? if (fallingPrims < 10) { _HeightMap = LandingHieghts; } if (fallingPrims != 0) { CollisionPlane.Debug("fallingPrims left over {0} MaxTries Left over = {1}", fallingPrims, MaxTries); } else if (y % 100 == 0) { CollisionPlane.Debug("Y={0} MaxTries Left over = {1}", y, MaxTries); } } }