codeAPI Reference

s&box SelfCollisionSound: Single-surface collision sounds

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

SelfCollisionSound Component API Reference

SelfCollisionSound is a Component that plays collision sounds only from this object's surface, preventing duplicate sounds from both impacting surfaces. Implements ICollisionListener.

Type Signature

CSHARP
public sealed class SelfCollisionSound : Component, Component.ICollisionListener
{
    public void Play(PhysicsShape shape, Surface surface, in Vector3 position, float speed);
}

Methods

Play(PhysicsShape shape, Surface surface, in Vector3 position, float speed)

Plays the collision sound from the specified surface. Only plays if speed >= 50 and surface is valid.

ICollisionListener Implementation

Behavior

In OnStart:

  • Disables default collision sounds on all Rigidbody components (EnableCollisionSounds = false)

Usage

CSHARP
// Add to GameObject to prevent duplicate collision sounds
GameObject.Components.Create<SelfCollisionSound>();

Notes

  • Prevents duplicate collision sounds by disabling default sounds
  • Only plays sounds from this object's surface
  • Minimum speed threshold of 50 units/s
  • Sealed class (cannot be inherited)
  • Useful for props where you want single collision sounds
Was this helpful?