Description
The EnableCollision
property of the Terrain
class determines whether collision detection is enabled for the terrain. When set to true
, the terrain will participate in physics calculations, allowing objects to collide with it. If set to false
, the terrain will not interact with physics, and objects will pass through it without any collision response.
Usage
To enable or disable collision detection for a terrain, set the EnableCollision
property to true
or false
respectively. This can be useful for optimizing performance by disabling collision on terrains that do not require it.
Example
// Example of enabling collision on a terrain
Terrain myTerrain = new Terrain();
myTerrain.EnableCollision = true; // Enable collision detection
// Example of disabling collision on a terrain
myTerrain.EnableCollision = false; // Disable collision detection