Terrain Response

Terrain Response specifies terrain layers and broadcasts liftoff/landing events about the player contacting the terrain. Any script can subscribe to these events. It also plays liftoff/landing audio according to its own events.

There are two categories of terrain: ground and nonground. Ground is considered a more particular kind of terrain, usually characterized by being relatively flat such as a floor or the surface of the earth – although you can associate it with whatever you like. The nonground category is meant to be used for other terrain aspects such as rocks, debris, stairs, crates, and the like (depending on how your game will work).

Player collision and raycasting are used with both terrain categories to track whether the player is currently grounded (colliding with ground terrain) or terrained (colliding with either ground or nonground terrain).

For example, by default, Booster Diminishing only recognizes ground terrain. Nonground terrain might be a rock, for example, which you don't want to affect Booster Diminishing. If the player is flying at max height over the terrain, and rocks are considered to be ground terrain, the player would "ride" over the rock, even though the player is quite high up and it might not make sense for the rock to affect the player's altitude. In that case you could simply change the rocks to a nonground terrain layer so that Diminishing won't recognize it. Determine what makes the most sense for your situation.

Or for another example, maybe you want to allow Flipping only while touching ground terrain, whereas Treading is allowed while touching any kind of terrain, including a rock. That way, you can't flip upside down while standing on a rock, but you can still walk around on, and off of, the rock. So you would assign rocks to the nonground terrain layer. Then you would select the logic on both of those locomotions for when they are allowed, using the Dependencies "When Grounded" and "When Terrained" for each locomotion, respectively.

You can find the Terrain Response component directly on the Player prefab:

This is where you'll want to define which layers are considered ground terrain and nonground terrain. To change the layers for either of these recognized categories, edit the arrays shown above to match your particular layer names set in your Unity project's layers definitions.