Description
The DisableCollisionSounds
field is a member of the RigidbodyFlags
enumeration in the Sandbox namespace. This flag is used to control the behavior of rigidbody components in a game environment, specifically to prevent automatic sound effects from being played when the object collides with another object.
Usage
Use the DisableCollisionSounds
flag when you want to suppress collision sound effects for a particular rigidbody. This can be useful in scenarios where you want to manage sound effects manually or when collision sounds are not desired for certain objects.
To apply this flag, you can combine it with other RigidbodyFlags
using bitwise operations, as RigidbodyFlags
is marked with the System.FlagsAttribute
, allowing for a combination of multiple flags.
Example
// Example of using DisableCollisionSounds flag
// Assume 'rigidbody' is a reference to a Rigidbody component
rigidbody.Flags |= RigidbodyFlags.DisableCollisionSounds;
// This will ensure that no collision sounds are played for this rigidbody
// when it collides with other objects.