> For the complete documentation index, see [llms.txt](https://flora.magneticarcade.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flora.magneticarcade.com/samples/terrain-samples.md).

# Terrain Samples

Scenes showcasing runtime terrain features.

These scenes use Flora's runtime APIs to interact with Terrain trees.

## Tree Effect

Animates Terrain trees inside a sphere.

<figure><img src="https://2882982566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyo4B7EVXffipTxnJzee6%2Fuploads%2Fgit-blob-ddab227448145397306d391b55359321f22204fb%2Ftree-effect-6-4-5.webp?alt=media" alt="Tree Effect sample"><figcaption></figcaption></figure>

### Scene Path

`Terrain/Scenes/TreeEffectSample.unity`

### Demonstrates

* Tree instance query by sphere
* Local-to-world retrieval and update
* Per-instance runtime animation without converting trees to scene objects

### APIs

* `FindInstancesIntersectingSphereMatching(...)`
* `GetInstanceLocalToWorlds(...)`
* `UpdateInstanceLocalToWorlds(...)`
* `FloraInstanceFilter.ByTrees()`

### Run

1. Open `TreeEffectSample` and press Play.
2. Confirm trees inside the sphere animate and recover after leaving it.

## Tree Wrecking Ball

Disables impacted Terrain trees and spawns Rigidbody replacements.

<figure><img src="https://2882982566-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fyo4B7EVXffipTxnJzee6%2Fuploads%2Fgit-blob-7e5a746d5015b6f9f3014d9e47faf210dc166443%2Ftree-wrecking-ball-6-4-5.webp?alt=media" alt="Tree Wrecking Ball sample"><figcaption></figcaption></figure>

### Scene Path

`Terrain/Scenes/WreckingBallSample.unity`

### Demonstrates

* Collision-region tree query
* Instance enable/disable control
* Runtime replacement with `GameObject` + `FloraInstanceRenderer`

### APIs

* `FindInstancesIntersectingSphereMatching(...)`
* `SetInstancesEnabled(...)`
* `GetInstanceWorldTransform(...)`
* `GetInstanceOwnerTerrain(...)`
* `GetInstanceTerrainTreeIndex(...)`

### Run

1. Open `WreckingBallSample` and press Play.
2. Let wrecking ball collide with trees.
3. Confirm impacted Flora instances are hidden and replaced with Rigidbody objects.
