Reputation: 372
I added the Reasonance Audio Source to an object and wanted to generate a sound when a collision between that object and another object occurred.
The issue I am having is that OnCollisionEnter in Unity is triggered whenever the object gets within the "audio region" (a blue disk attached to the object with a certain radius). However, what I am interested is when the physical collision occurs, and not this "audio" collision.
One way to go around it is just to create a copy of that object, without the Reasonance Audio Source which follows the motion of the other object. Then you trigger collisions the object copy. But I was wondering if there is any way to differentiate these two types of collisions in Unity?
Here is an example. Red ball is the object I want to generate the sound from and that has the Reasonance Audio Source as a component. The blue region is created from that component. Whenever the blue disk touches the grey floor, a collision is generated. I would like to disable this "audio" collision and have only a collision being detected when a physical collision between the red ball and the grey floor occurs.
EDIT: Found the problem. I had been testing the PhysicsManager properties (Edit/Project Settings/Physics) and I had the "Default contact offset" set to 0.01 which by change was the same as the blue region, so I went looking for a problem in the wrong place. I now changed the contact offset to a smaller value and all is ok.
Upvotes: 0
Views: 82
Reputation: 649
In the PhysicsManager properties (Edit/Project Settings/Physics) the "Default contact offset" defines the blue region. Change the value to a smaller one to resize the contact region.
OLD ANSWER:
Without knowing your scene or code i can only speculate that you might want to turn of the audio sources collision and trigger it manually when the collision with the object occurs. Just attach a script that listens for a collision and then trigger the collision event of the audio source (or just play the sound).
Upvotes: 1