SoundPhysics
The SoundPhysics component can be used to easily play physics sounds

(SoundPhysics is remade in Sonity 1.0.5 with expanded functionality)
SoundPhysics is a component used for easily playing SoundEvents on physics interactions. SoundPhysics is split up into 3D/2D versions with and without friction because of performance reasons. If friction sounds arenβt needed and performance is a priority then use the SoundPhysics with no friction. A Rigidbody/Rigidbody2D is required on this object. One or several Collider/Collider2D should be placed on this object or its children. Use intensity record in the SoundEvent for easy scaling of the velocity into a 0 to 1 range. All SoundPhysics components are multi-object editable.
Impact Is triggered when the object starts touching a collider. OnCollision uses velocity from Collision.relativeVelocity.magnitude and the position of the Collision.contacts with the highest impulse.magnitude. OnTrigger uses velocity from Rigidbody.velocity.magnitude.
Friction Is triggered when the object is continuously touching a collider. Uses velocity from Rigidbody.velocity.magnitude.
Exit Is triggered when the object stops touching a collider. Uses velocity from Rigidbody.velocity.magnitude.
SoundEvent The SoundEvents which are to be played.
Play On Selects if the SoundEvents should be played when a OnCollision and/or OnTrigger event occurs. OnTrigger is when you have a collider which is set to βIs Triggerβ.
Conditions If enabled then any SoundPhysicsCondition added will be used to decide if the physics interaction should play a SoundEvent or not. SoundPhysicsConditions can also be used for playing different sounds with a single SoundEvent by assigning SoundTags in the SoundPhysicsConditions.
SoundTags If enabled then any SoundTags added will be sent when triggering the SoundEvent. If a SoundTag is not null it will override any SoundTags which might be sent through the SoundPhysicsConditions. SoundTags can be used for triggering different sounds with a single SoundEvent.
Intensity All SoundEvents played with SoundPhysics are sent a velocity through the SoundParameterIntensity. This can be used to control the sound e.g. making it quieter when the velocity is lower. Read more at SoundParameterIntensity. For how to debug playing sounds in the scene/game view check out SoundManager Draw SoundEvents.
Example of how to record and debug SoundParameterIntensity. This is helpful for scaling the incoming velocity values to a 0 to 1 range.

SoundPhysicsCondition

SoundPhysicsCondition objects are used in the Β΄component to decide if a physics interaction should play a SoundEvent or not. They make it easy to manage a large amount of physics objects and linking conditions together with the child nesting feature. You can also use them for playing different sounds with a single SoundEvent by using SoundTags. All SoundPhysicsCondition objects are multi-object editable.
Notes At the top of the SoundPhysicsCondition there is a text field which you can fill with notes.
Children You can nest SoundPhysicsConditions so you don't have to update all your SoundPhysics components when adding a new SoundPhysicsCondition. The children of the parent SoundPhysicsCondition are evaluated after the parent.
Parent The parent SoundPhysicsCondition is evaluated before the children.
SoundTag By utilizing the SoundTags you can play different sounds with a single SoundEvent (see the example physics assets on how you can set that up). If no SoundTag is assigned it won't affect the output SoundTag, so if a child has an assigned SoundTag and the parent doesn't, the child one will be used. They are useful to split into different child SoundPhysicsConditions with different SoundTags.
Play On Selects if it should be played when a OnCollision and/or OnTrigger event occurs. OnTrigger is when you have a collider which is set to βIs Triggerβ.
Play Disregarding Conditions If enabled the SoundPhysicsCondition will play regardless of its own conditions. Useful to combine with child SoundPhysicsConditions with different SoundTags.
Abort All On No Match If enabled and the assigned condition is not matched it will abort playing and disregard all other conditions. If not enabled and the assigned condition is not matched another condition which is met can play the sound.
Abort All On Match If enabled and the assigned condition is matched it will abort playing and disregard all other conditions. If not enabled and the assigned condition is matched another condition which is met can play the sound.
Tag
Checks if the Tag of the colliding GameObject matches any of the specified Tags.
Layer
Checks if the Layer of the colliding GameObject matches any of the specified Layers.
Terrain Name
Checks if the name of the most dominant Terrain Layer of the colliding Terrain contains any of the specified strings (it is not case sensitive). E.g. you have multiple Terrain Layers with different grass textures, if the names of the Terrain Layers contain the string it will play the sound. Terrain conditions are only evaluated if the colliding object has a Terrain component. The center point of the SoundPhysics object is used to calculate the dominant Terrain Layer because it is more stable than the contacts.
Terrain Index
Checks if the index of the most dominant Terrain Layer of the colliding Terrain is any of the specified indexes. Terrain conditions are only evaluated if the colliding object has a Terrain component. The center point of the SoundPhysics object is used to calculate the dominant Terrain Layer because it is more stable than the contacts.
Component
Checks if the Components of the colliding GameObject match any of the specified Components. The names are case sensitive.
Asset GUID
The ID of an asset is cached in the editor because in some cases when using addressables a single scriptable object might be instantiated multiple times. This might lead to problems where a simple "Object == Object" check will return false, but a "ID == ID" will return true. If you are upgrading Sonity and use addressable assets you probably want to select all Sonity scriptable objects and run: "Tools/Sonity π/Set Selected Assets as Dirty (Force Reserialize for Resave)" which will force the assets to cache the GUIDs. You can search t:SoundEvent, t:SoundContainer, t:SoundTag, t:SoundPolyGroup, t:SoundDataGroup, t:SoundMix, t:SoundPhysicsCondition to find all objects. If no GUID is cached then it will use the InstanceID in builds. The free trial version doesn't have full functionality.
Last updated