Description
The Static
property of the Collider
class indicates whether the collider is static. A static collider does not move and is typically used for objects that are part of the environment, such as walls or floors. This property is a boolean value, where true
means the collider is static, and false
means it is not.
Usage
To use the Static
property, you can access it directly from an instance of a Collider
object. Setting this property to true
will make the collider static, which means it will not respond to physics forces or collisions in the same way a dynamic collider would.
Example
// Example of setting a collider to be static
Collider myCollider = new Collider();
myCollider.Static = true;
// Check if the collider is static
if (myCollider.Static)
{
// Perform actions specific to static colliders
// For example, logging or setting up static collision responses
}