Page cover

bowling-ballTerrain Samples

Scenes showcasing runtime terrain features.

These scenes demonstrate terrain tree interaction workflows driven by Flora instance APIs.


Tree Effect

This sample animates terrain tree instances inside a spherical influence volume.

Tree Effect sample

Scene Path

Samples~/Examples/Terrain/Scenes/TreeEffectSample.unity

What This Demonstrates

  • Tree instance query by sphere

  • Local-to-world retrieval and update

  • Per-instance runtime animation without converting trees to scene objects

APIs Exercised

  • FindInstancesIntersectingSphereMatching(...)

  • GetInstanceLocalToWorlds(...)

  • UpdateInstanceLocalToWorlds(...)

  • FloraInstanceFilter.ByTrees()

Run and Verify

  1. Open TreeEffectSample and press Play.

  2. Move/observe effect sphere region.

  3. Confirm nearby trees animate and recover when leaving the region.

Expected result: only trees in-range are displaced/animated.

Common Failure Checks

  • No response: verify EnableTerrainFoliage and terrain auto-registration.

  • Trees remain offset after stop: check cleanup/restore path in sample script.


Tree Wrecking Ball

This sample demonstrates physics interaction that disables terrain-tree instances and spawns replacement rigidbody objects.

Tree Wrecking Ball sample

Scene Path

Samples~/Examples/Terrain/Scenes/WreckingBallSample.unity

What This Demonstrates

  • Collision-region tree query

  • Instance enable/disable control

  • Runtime replacement with GameObject + FloraInstanceRenderer

APIs Exercised

  • FindInstancesIntersectingSphereMatching(...)

  • SetInstancesEnabled(...)

  • GetInstanceWorldTransform(...)

  • GetInstancePrefab(...)

  • GetAuthoringTerrainOf(...)

Run and Verify

  1. Open WreckingBallSample and press Play.

  2. Let wrecking ball collide with trees.

  3. Confirm impacted trees are hidden as Flora instances and replaced with rigidbody objects.

Expected result: collision zone trees convert to physics-driven replacements; Flora instances are disabled.

Common Failure Checks

  • Trees never disable: verify query region radius/position is valid.

  • Replacements missing Flora rendering: ensure FloraInstanceRenderer is added and prefab assigned.

Last updated