Unity Physics — The lay of the land with Terrain Colliders

Sean Duggan
2 min readMay 23, 2024

--

A common tool for designing natural landscapes in Unity is Terrain. Without going into a ton of detail, there are tools available for setting height, material, and texture of the surfaces of a level. In this case, we’re looking at the physics of it, which will involve a Terrain Collider. The short version of things is that, if we have a heightmap, developed in-engine or as a texture, we can create a physics object for it in an optimized manner to handle interactions.

Example Case

I happen to have an example case, with a small terrain (side note, scaling of terrain can have some weird physics cases, so it’s best to keep it at the 1,1,1 setting of one unit meaning one meter. You can change the resolution of a Terrain object via the Terrain Settings of your Terrain object) and an object to drop on it.

To add the Terrain Collider, you just add a Terrain Collider Component and designate your terrain data.

Optionally, you disable the Tree Collider, unless you specifically have tree data. Making sure that your object has the relevant Colliders (in my case, a Box Collider), you can see how it just all kind of works.

I’m sure there will be some refinements of this process, but for now, it’s gratifying to know that I can arrange a heightmap and have it work with the physics.

--

--