---
title: "add(_:at:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkoctree/add(_:at:)"
---

# add(_:at:)

Adds an object to the tree corresponding to the specified point in 3D space.

## Declaration

```swift
func add(_ element: ElementType, at point: vector_float3) -> GKOctreeNode
```

## Parameters

- `element`: The object to add to the tree.
- `point`: The point in 2D space to which the object corresponds.

## Return Value

Return Value The tree node containing the newly added object.

## Discussion

Discussion The GKOctree class automatically creates nodes to manage the objects you add to the tree. If you expect to remove an element you’ve added, keep a reference to the node this method returns so you can use the remove(_:using:) method to remove that object quickly.

## See Also

### Adding and Removing Elements

- [add(_:in:)](gameplaykit/gkoctree/add(_:in:).md)
- [remove(_:using:)](gameplaykit/gkoctree/remove(_:using:).md)
- [remove(_:)](gameplaykit/gkoctree/remove(_:).md)
