Impact Sound Player
Diegetic sounds can be tough and scaling only volume with impact force doesn't sound right. May as well have three distinct sounds, right?
Requires:
- VRC Pickup
- VRC Object Sync
- Rigidbody
- Audio Source attached to GameObject (3)
Small Impact Sound Object - Type: GameObject
- Enables the GameObject under the condition that the velocity on impact with another collider is less than the Medium Impact Threshold.
Medium Impact Sound Object - Type: GameObject
- Enables the GameObject under the condition that the velocity on impact with another collider is more than the Medium Impact Threshold, but less than the Large Impact Threshold.
Large Impact Sound Object - Type: GameObject
- Enables the GameObject under the condition that the velocity on impact with another collider is more than the Large Impact Threshold.
Medium Impact Threshold - Type: Float
Large Impact Threshold - Type: Float
Usage Instructions:
- Attach this script to a GameObject in Unity.
- Assign the respective GameObjects for the Small, Medium, and Large Impact Sound Objects.
- Set the desired thresholds for Medium Impact Threshold and Large Impact Threshold.
- Ensure the GameObject has the required components: Rigidbody, VRC Pickup, and VRC Object Sync.
Script Behavior:
- When a collision occurs, the script evaluates the impact velocity:
- If the velocity is less than the Medium Impact Threshold, the Small Impact Sound Object is activated.
- If the velocity is between the Medium and Large Impact Thresholds, the Medium Impact Sound Object is activated.
- If the velocity is greater than the Large Impact Threshold, the Large Impact Sound Object is activated.