<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKRTree/removeElement(_:boundingRectMin:boundingRectMax:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKRTree(im)removeElement:boundingRectMin:boundingRectMax:"
  },
  "title" : "removeElement(_:boundingRectMin:boundingRectMax:)"
}
-->

# removeElement(_:boundingRectMin:boundingRectMax:)

Removes the specified object from the tree.

```
func removeElement(_ element: ElementType, boundingRectMin: vector_float2, boundingRectMax: vector_float2)
```

## Parameters

`element`

The object to be removed from the tree.

`boundingRectMin`

The corner (with the lowest x- and y-coordinate values) of the bounding region to search for the object to remove.

`boundingRectMax`

The corner (with the highest x- and y-coordinate values) of the bounding region to search for the object to remove.

## Discussion

Removing an object from the tree requires first finding that object within the tree’s internal structure. Because the tree organizes itself spatially, you must search for the node to be removed based on the region it occupies. The `boundingRectMin` and `boundingRectMax` parameters identify this region—to remove an element from the tree, those parameters must identify a region which entirely contains (or is the same as) the region you specified when adding that node to the tree with the [`addElement(_:boundingRectMin:boundingRectMax:splitStrategy:)`](/documentation/GameplayKit/GKRTree/addElement(_:boundingRectMin:boundingRectMax:splitStrategy:)) method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)