RigidbodyFlags DisableCollisionSounds

book_4_sparkGenerated
code_blocksInput

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 physics simulation, 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 the RigidbodyFlags enumeration is marked with the System.FlagsAttribute.

Example

// Example of using DisableCollisionSounds flag
RigidbodyFlags flags = RigidbodyFlags.DisableCollisionSounds;

// Combine with other flags
flags |= RigidbodyFlags.SomeOtherFlag;

// Apply to a rigidbody component
RigidbodyComponent rigidbody = new RigidbodyComponent();
rigidbody.Flags = flags;