private bool CanSetSurfaced(IHitBox hitBox) { FloatRectangle bounds = hitBox.BoundingBox.Bounds; float x = bounds.X; float w = bounds.Width; float y = bounds.Bottom; float h = MagicNumbers.AcceptableSurfaceDistance; var rectangle = new FloatRectangle(x, y, w, h); var fit = CollisionDetection.CanFitInMatrix(rectangle); if (fit == FitResult.Solid) // ensure that the surface actually blocks further movement. { return(true); } return(false); }