public override void Update(double deltaTimeInSeconds) { if (GameTime.FrameCount % 6 != 0) { if (this.Entity is GameObject gameObject && gameObject?.PhysicsNode != null) { // check past min/max bounds // the border was chosen experimentally to see what feels good var position = gameObject.PhysicsNode.PresentationNode.WorldPosition; // this is only checking position, but bounds could be offset or bigger var shouldRemove = SCNVector3.ComponentMin(position, MinBounds) != MinBounds || SCNVector3.ComponentMax(position, MaxBounds) != MaxBounds; if (shouldRemove) { gameObject.Disable(); } } } }