Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kaleetos · Jul 25, 2011 at 09:00 PM · audiosource3d sound

Is directional sound possible?

I'm wondering if there is a way to create a sound which emanates from the source in a "spotlight" fashion. That is to say, when you are standing N-meters in front of the source it would be louder than when you are standing N-Meters behind the source, AND --as you approach the ray in which the sound source is pointing in, the sound will get louder (Something like a megaphone, but with more focus). I know I can emulate the effect via scripting but before I do that I wanted to make sure that there isn't something already built into Unity that I missed.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Jul 25, 2011 at 10:03 PM

As far as i know there are no builtin spot-audio-sources in Unity. You would have to emulate it like you've mentioned.

There should always be only one audiolistener in the scene and that's normally at your camera. You can use FindObjectOfType to find the listener in the scene (once in start of course) and then just calculate the angle between the spot direction and your listener position. Vector3.Angle should help.

Just attach the script to your audio source and adjust the volume depending on the angle.

That's just 2 or 3 lines of code ;)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kaleetos · Jul 25, 2011 at 10:06 PM 0
Share

Thanks bunny. Thats what I figured I would have to do, but I thought maybe--just maybe-- there is a better optimized built in way of doing it. Something for a future version perhaps? :)

avatar image
0

Answer by Dreamblur · Jul 25, 2011 at 09:25 PM

Once you attach an audio clip to a game object, you'll have access to the AudioSource members. With the game object which the audio clip is attached to currently selected, click on the fold-out option named 3d Sound Settings on the Inspector. Edit those settings to suit your purposes.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kaleetos · Jul 25, 2011 at 09:45 PM 1
Share

I'm aware of this. The problem is that the 3d-sound settings don't seem to offer any way to "point" the sound in a specific direction. At first I thought that maybe that is what the "spread" was for. It seems, however, that the spread just deter$$anonymous$$es whether the 3d sound emanates in stereo or in mono. I'm going to go ahead an assume that this actually isn't built into Unity. Thanks for the answer anyway.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

3D-audio-source limit 0 Answers

Attach audio source to different part of object 0 Answers

Making Audio sound like it's behind you in a text game 0 Answers

Repurposing the inspector graph module 2 Answers

Need help with 3d sound 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges