POLYMASON

Tree colliders in Unity

Part of LODs and billboards for low poly models

A tree should collide with the player at its trunk and nowhere else. The player walks under the canopy and past the branches, and a collider that follows the foliage traps them in a green box. This guide sets up the collider for a tree placed by hand and for one painted on terrain. It sits on the same prefab as the LOD Group and the billboard, which are both part of levels of detail for low poly models. The importer setting that adds the wrong collider is on the tab the Unity import article walks through.

The wrong collider

Unity's model importer has a Generate Colliders checkbox that adds a Mesh Collider to every mesh in the file. For a prop, that's often right. For a tree, it wraps the foliage. The player can't walk under the boughs or stand near the trunk, and the physics engine spends time on hundreds of triangles per tree that do nothing useful. Leave it off for trees.

The right one

Put a Capsule Collider on the trunk:

  1. Select the tree's root GameObject, or its prefab.
  2. Add Component, Capsule Collider.
  3. Set Direction to Y-Axis, Radius to the trunk's radius at chest height, Height to the trunk's height up to the first bough, and Center to half that height so the capsule stands on the ground.

The capsule keeps the player from walking through the trunk and lets them walk under everything else. It's also what Unity's own terrain trees use, and what every game does. For a tree with a wide base or a leaning trunk, add a second capsule, or put a cylinder-ish mesh collider on the trunk mesh alone. Never put one on the foliage.

For a low poly tree whose trunk and foliage are one mesh, which is how a palette-textured export comes, the capsule is the only sane option anyway, because a mesh collider would have to include the foliage.

The felled trunk, the stump and the logs

A fallen tree gets a capsule lying down, with Direction set to Z-Axis, or a Box Collider the length of the trunk. A stump gets a short capsule or a cylinder. Logs get small capsules. If the player can pick them up, add a Rigidbody as well. The capsule gives stable physics where a mesh collider would jitter.

Terrain trees

Trees painted onto a Unity Terrain take their collider from the prefab. If the prefab has a Capsule Collider, the terrain uses it. If it has none, there is no collision. The terrain's own Tree Collider handling supports capsule colliders only, which is another reason to use one. Give the prefab the capsule before you start painting.

Layers and cost

If the project has many trees, put them on their own physics layer so raycasts for other things can skip them. A capsule is the cheapest shape after a sphere, and a thousand of them cost nothing.

The same elsewhere

  • Godot: use a CollisionShape3D with a CapsuleShape3D, under a StaticBody3D that's a sibling of the mesh. The Mesh menu's Create Trimesh Collision is the wrong tool for a tree, for the same reason Generate Colliders is.
  • Unreal: in the Static Mesh editor, open the Collision menu and choose Add Capsule Simplified Collision, then size it to the trunk. Turn off Auto Generate Collision on import.

What PolyMason exports

The tree builder writes the trunk's height and diameter in the zip's spec, so you can read the capsule's numbers from there. The model stands on the ground at the origin, so the capsule's center is half the trunk height up, with no other offset.

More in this guide

  • LODs and billboards for low poly modelsHow levels of detail work, what triangle counts are reasonable for low poly trees, rocks, buildings and characters, how to make the levels so the swap doesn't pop, billboards and impostors for the far distance, and the LOD setup in Unity, Godot and Unreal.
  • Unity's LOD Group from separate model filesHow to build a LOD Group in Unity from three separate model files, what the screen-height thresholds mean, the naming convention that makes the importer build the group for you, fade modes, LOD Bias, and how LOD Groups work with batching and instancing.
  • Billboard trees in Unity for the far distanceWhat a tree billboard is, how to make the picture, the two ways to show one in Unity (a quad with a cutout material, or a Billboard Renderer), how terrain trees do it for you, and the settings that keep it from looking flat.
  • Godot 4 LODs: mesh LODs and visibility rangesGodot 4 has two LOD systems, the automatic mesh LODs the importer generates and the visibility ranges you set on nodes. This covers how to control each, fading between levels, and how they work with MultiMesh for a forest.

Or build a tree and see what comes out.