void Update() { float time = Time.time; // Reduce check interval if (lastCheck + checkInterval < time) { lastCheck = time; // Get current tile position Vector3 position = transform.position; int x = Mathf.FloorToInt(position.x); int y = Mathf.FloorToInt(position.z); // Update atmos object if tile changed if (x != lastX || y != lastY) { lastX = x; lastY = y; atmosObject = tileManager.GetTile((int)(x - origin.x), (int)(y - origin.z))?.atmos; } // Check velocity if (atmosObject != null) { ApplyVelocity(atmosObject.GetVelocity()); } } }