|
Post by illustrator on Apr 17, 2020 11:57:59 GMT
It seems "Max distance" minimum value is 10. Is there a reason for this limitation?
I use Ambient sound for a AI enemy to emit sound so that player can hear when it's nearby. For my use case I'd need the sound "Max distance" to be smaller, maybe around 5 so that player could not hear the enemy too far away.
|
|
|
Post by DarkTonic Dev on Apr 17, 2020 15:20:00 GMT
So what looks like is happening is that you can't adjust the Max Distance to less than the Min Distance, which is 10 on your Audio source. I know the slider doesn't tell you that. I think that modifying the min distance on a slider for Max Distance automatically would not be good, so what do you advise we should do about this?
1) Display the tooltip showing the Min Distance and saying you can't go below that? 2) Or add a checkbox to allow modifying the Min Distance if you go below it?
-Brian
|
|
|
Post by illustrator on Apr 18, 2020 11:45:52 GMT
Thanks for the clarification. I found the Max distance from the Audio sources 3D sound settings. I adjusted the trigger sizes from there. I removed the Ambient sound script from the game object and added it back and now the Max distance is smaller.
I'm not quite sure which option would be better. Maybe improve the Master Audio documentation to tell user what to do and use the tooltip to point user to the right documentation.
I noticed that Audio source has two triggers. Modifying the larger trigger changes the Max Distance value but modifying the smaller does not seem to change any value on the Inspector. What is that smaller trigger used for? Is it referencing the key on the 3D sound settings (see image) or something else?
|
|
|
Post by DarkTonic Dev on Apr 18, 2020 17:57:55 GMT
Not sure what you mean by triggers. Max distance is what is used to determine whether the sound in audible or not by Ambient Sound. Everything else determines how loud it is by the Unity audio engine based on how far away it is from the Audio Listener. it's called the rolloff curve and can have any number of points on that graph. You can add more.
You can read about that on the Unity documentation.
|
|
|
Post by illustrator on Apr 19, 2020 7:21:02 GMT
"It accomplishes this by creating a trigger the size of the Audio Source's Max Distance that follows the caller's position"
I thought those two gizmos are the triggers but apparently they are not. Anyway ambient sound is working now.
|
|
|
Post by DarkTonic Dev on Apr 19, 2020 18:16:26 GMT
Well there's a trigger on the Scene view and there's also an Audio Source max distance shown there. Which should be the same.
I will add to the documentation and/or Inspector so there's more detail.
Thanks!
|
|
|
Post by DarkTonic Dev on Apr 19, 2020 21:19:38 GMT
I have added the Min Distance slider to Ambient Sound. You can't adjust the Max Distance to lower than the Min Distance, but now you can tweak the Min Distance and then be able to.
|
|
nathanj
Junior Member
Posts: 66
Posts: 66
|
Post by nathanj on Mar 9, 2022 0:28:12 GMT
Sorry for bringing this one back to life but I only see the sliders in runtime, is this intentional? Editor view: Runtime view: Or, are we just to edit these settings directly on the Audio Source? Sorry for all the questions
|
|
|
Post by DarkTonic Dev on Mar 9, 2022 3:00:07 GMT
I see those slider at both runtime and edit mode, however you need to select "Play Random" for them to be visible.
If you think that's not proper let me know.
The Audio Transform Tracker script is only at runtime.
|
|
nathanj
Junior Member
Posts: 66
Posts: 66
|
Post by nathanj on Mar 9, 2022 3:24:24 GMT
Why would it be that only if "Play Random" is selected they are visible? I still don't get the sliders in edit more when I select "Play Random": This is with Unity 2020.3.25 HDRP, Master Audio 2022 1.0.1
|
|
nathanj
Junior Member
Posts: 66
Posts: 66
|
Post by nathanj on Mar 9, 2022 11:04:52 GMT
OK, I figured it out.
The Min/Max sliders are available when the Audio Group is assigned to the Master Audio Object. The reason I could not see it was that I have my sound group dynamically assigned at runtime with DynamicSoundGroupCreator. This explains why I see the sliders in runtime only.
Can you think of any way around this? Also, is there a Gizmo for the Ambient Sound object to show where the sound source is in runtime?
|
|
|
Post by DarkTonic Dev on Mar 10, 2022 22:06:45 GMT
Unfortunately no, that code would be overkill and run pretty slow, to find the correct DSGC and group and modify the Audio Source properties.
As far as runtime, there's a speaker icon where the sound is playing by default in Unity.
|
|
nathanj
Junior Member
Posts: 66
Posts: 66
|
Post by nathanj on Mar 11, 2022 3:20:40 GMT
Ok, that's fine. I can just add a prefab of the Master Audio component to my scene and have it destroyed in runtime. You mind helping me trouble shoot the Ambient Sound component in my scene? I haven't been able to get it to work yet since reinstalling MA. I have an Ambient Sound component with two Mesh Colliders as children. These run along the shoreline. But when I enter the scene the Shoreline audio basically snaps to my player's loctaion. Can you see anything I'm doing wrong here? Thanks again. Nathan
|
|
nathanj
Junior Member
Posts: 66
Posts: 66
|
Post by nathanj on Mar 11, 2022 3:33:53 GMT
Probably help if i read the messages :facepalm:
Physics.ClosestPoint can only be used with a BoxCollider, SphereCollider, CapsuleCollider and a convex MeshCollider. UnityEngine.Collider:ClosestPoint (UnityEngine.Vector3) TransformFollower:RecalcClosestColliderPosition (bool) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Utility/TransformFollower.cs:311) DarkTonic.MasterAudio.MasterAudio:RecalcClosestColliderPositions () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1361) DarkTonic.MasterAudio.MasterAudio:ManualUpdate () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1260) DarkTonic.MasterAudio.MasterAudio:LateUpdate () (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1247)
|
|
nathanj
Junior Member
Posts: 66
Posts: 66
|
Post by nathanj on Mar 11, 2022 3:41:43 GMT
OK, So changing the Mesh Collider to Convex totally changes the shape, making it not usable. So given this terrain, I can't really see a way for creating an ambient sound solution for the shoreline. I've asked for this before, but any chance you would consider a spline option for the Ambient Sound component? Nathan
|
|