Submarines, items and characters that reach a depth of 300,000 units (~4000 m) are automatically disabled. Avoids the unnecessary cost of updating entities that are way too deep to be reached by anyone.
This commit is contained in:
@@ -139,12 +139,17 @@ namespace Barotrauma
|
||||
|
||||
if (Level.Loaded != null && clampPos)
|
||||
{
|
||||
position.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f);
|
||||
interpolatedPosition.Y -= Math.Max(worldView.Y - Level.Loaded.Size.Y, 0.0f);
|
||||
float maxY = Level.Loaded.Size.Y + 100;
|
||||
|
||||
worldView.Y = Math.Min((int)Level.Loaded.Size.Y, worldView.Y);
|
||||
position.Y -= Math.Max(worldView.Y - maxY, 0.0f);
|
||||
interpolatedPosition.Y -= Math.Max(worldView.Y - maxY, 0.0f);
|
||||
|
||||
position.Y = Math.Max(position.Y, (int)Level.MaxCameraDepth);
|
||||
interpolatedPosition.Y = Math.Max(interpolatedPosition.Y, (int)Level.MaxCameraDepth);
|
||||
worldView.Y = MathHelper.Clamp(worldView.Y, (int)Level.MaxCameraDepth, (int)maxY);
|
||||
}
|
||||
|
||||
|
||||
transform = Matrix.CreateTranslation(
|
||||
new Vector3(-interpolatedPosition.X, interpolatedPosition.Y, 0)) *
|
||||
Matrix.CreateScale(new Vector3(interpolatedZoom, interpolatedZoom, 1)) *
|
||||
|
||||
Reference in New Issue
Block a user