Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here:
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Physics [WIP] Physics Audio Collision System Plugin [Official]

Discussion in 'Tools In Progress' started by niv-, Apr 20, 2021.

  1. niv-


    Apr 20, 2021
    Howdy guys and gals o/

    We are creating a Physics Audio System that can handle most if not all the collision / joint audio in your game while drastically reducing the amount of effort required to implement this kind of interaction.

    Our goal is to develop it as user friendly as possible, optimize it and ensure that is is production ready by the end of May 2021.

    Ease of use:

    Setting up collision sounds can be a huge pain in the butt; multiple audio samples for impacts, loops for sliding, setting up and hand tweaking Audio Sources/collision parameters … per item …

    The simplest workflow we could come up with was: selecting a gameobject with either a rigidbody or collider on it and adding a single component to make it work. (no Audio Sources required on your prefabs)

    We chose to wrap the audio and its settings into an Audio Material similar to Physics Materials in unity.
    So that we don't have to tweak any parameters on the components themselves since this will result in tweaking the prefabs instead of tweaking shared assets.

    Furthermore this system does not create any additional / unwanted gameobjects inside the editor nor during runtime to make this work.

    We like to leave layers and tags open to you if we can. (so far the system does not require them)

    And we would also like the system to support unity 5 and above.

    Recording audio:

    Instead of having to record multiple impact sounds and sliding loops per item we figured out a way to do it with a single sliding loop.

    This drastically reduces the amount of work needed to record the audio itself.


    After a quick look at Unities Audio Source component it becomes clear that
    having an Audio Source per object and an Update loop per component isn't the way to go, thus
    we designed our system so that it handles everything with a single Audio Source and Update loop.

    The Manager calculates the priority of the audio objects in the scene, filters out the most active and nearest ones,
    combines all the collected audio and plays it all through a single Audio Source.

    This results in an optimized setup with a fixed amount of ms that we can control through global settings.

    What we have so far:

    We have the main system working specifically the manager, the Audio Material assets And our main audio component that attaches to the objects in the scene.

    Physics Audio Component:

    Physics Audio Material:

    Physics Audio Manager:

    System at work:
    (the audio in this video is recorded using our personal headset, better audio is in the make)

    what we like to add before release:
    • add a way to have multiple audio materials on the same Rigidbody (physics object) V
    • make unity terrain compatible V
    • implement hinge joint and configurable joints V

    what we want from you:
    • We would love to get feedback before this asset is released, your wants and needs.
    • We would like to hear questions about anything that is not clear or in doubt.
    • We would like to get a feel of how useful this asset would be, can you use this in one of your projects?
    • We would like some beta testers before the asset hits the store.
    Last edited: Jul 2, 2021
    AntonioModer likes this.
  2. niv-


    Apr 20, 2021
    Howdy fellow devs.

    The first milestone has been hit!

    It is now possible to add multiple audio materials to a single Rigidbody. (physics object)


    1) Assign PhysicsAudioDelegate: assign to the gameobject that has the rigidbody assigned to it

    2) Assign PhysicsAudio to child colliders: assign to the individual colliders of your object

    Keeping the workflow simple as usual ^^


    we added a performance field in our global settings to constraint the maximum allowed contact points when using PhysicsAudioDelegate components, and we are also avoiding SendMessage calls which are very slow.

    Physics Audio Delegate at work:

    Feedback and questions are welcome.
  3. Marked


    Feb 24, 2015
    Hi, I'm working on a vr game with a lot of interactable objects.
    I'm wondering what the performance is like and any limitations on maximum number of colliding sounds.
    interested in being beta tester, do you have discord?
  4. niv-


    Apr 20, 2021
    o/ Thanks for the comment.

    This system seems perfect for your game, VR combined with the current hassle that comes with setting up collision sounds for games is what inspired us to make it.

    The maximum number of simultaneous colliding sounds can be set trough global settings and directly reflects on the performance. This means that you have 100% control over the performance each frame.

    Here are some stats so you can get an idea of how it runs...

    With maxSimultaniousPriorityCalculations set to 30 and maxSimultaniousAudioBases set to 30, with 300 Audio Objects in the scene the system runs a steady 0.13ms on the main thread inside the editor on i5-4690K CPU @ 3.50GHz

    With maxSimultaniousPriorityCalculations set to 75 and maxSimultaniousAudioBases set to 75, with 300 Audio Objects in the scene the system runs a steady 0.21ms on the main thread inside the editor on i5-4690K CPU @ 3.50GHz

    With maxSimultaniousPriorityCalculations set to 300 and maxSimultaniousAudioBases set to 100, with 300 Audio Objects in the scene the system runs a steady 0.35ms on the main thread inside the editor on i5-4690K CPU @ 3.50GHz
  5. niv-


    Apr 20, 2021
    Howdy again mates.

    Milestone number 2 hits the dust.

    With the new TerrainAudio Component, your terrain is ready to make sOme NOISE!


    1) Assign TerrainAudio component

    2) Assign Terrain to the component

    3) Assign PhysicsAudioMaterials per terrain layer

    Furthermore a performance field was added to global settings

    Keeping the workflow clean and effortless as usual.
    Last edited: May 25, 2021
  6. niv-


    Apr 20, 2021
    Howdy amigos.

    We got sidetracked a bit to work on an exciting feature.

    We present ... Left vs Right ear delay. \o/

    What is this you might ask?

    Well imagine a collision sound on your left side, in real life the sound would hit your left ear before it hits your right ear.

    This method makes it possible to identify where an object hit the floor while left and right ear volumes are the same.

    In order to hear this effect you will need a headset.


    settings to enable this effect got added to global settings.

    we can basically fade the effect in and out.

  7. niv-


    Apr 20, 2021
    Howdy Developers.

    Our final milestone hits the sack.
    Hinge joints and Configurable joints are ready to party!


    1) Assign HingeAudio to a gameObject

    2) Assign the HingeJoint

    3) Assign HingeAudioMaterial

    Thesame workflow applies for linear hinges aka Configurable joints

    We also introduced 2 more AudioMaterial types, one for HingeAudio and another for LinearHingeAudio.

    and added the properties that are needed to our global profile.

    Keeping the workflow clean and effortless as usual.

    We are now going into our optimization and test phase, getting it production ready.
    AntonioModer likes this.