Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 monogon · Feb 06, 2015 at 02:48 PM · stereopanning3d sound

Simulate 3-D sound without Audiosource

Hey there,

I am trying to get a 3-D sound effect but unfortunately I cannot rely on the built-in solution because I am using G-Audio which does not work with Unity's Audiosources.

So I have several objects that are positioned in a virtual room. Every object sends Audio to its own track with separate panning and volume. Now I want to adjust the panning and volume of these tracks based on the position and rotation of the camera relative to these objects. Like simulated 3-D audio…

Adjusting the gain based on position is no problem so far. However, I am struggling with the panning.

Here is a script that is attached to my camera object. The target object is supposed to be the object emitting sound.

 public float GetAngle(Transform target) {
 
         Vector3 _vecRotation = target.position - transform.forward;
 
         float _angRotation = Mathf.Asin (Vector3.Cross (_vecRotation.normalized, Vector3.up).z);
 
         Vector3 _vecPosition = target.position - transform.position;
         float _angPosition = Mathf.Asin (Vector3.Cross (_vecPosition.normalized, Vector3.up).z);
 
         float _sumAng = _angRotation + _angPosition;
 
         if (_sumAng > 1f)
             _sumAng = 1f;
 
         if(_sumAng < -1f)
             _sumAng = -1f;
 
         return _sumAng;
     }

I think I am following a wrong approach.. I thought I have to calculate the rotational and positional panning separately but this might be completely wrong. Could someone with better knowledge of vector maths please help me? All I want is panning based on the position and rotation of the camera relative to the object. -1 for Left and +1 for Right.

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

0 Replies

· Add your reply
  • Sort: 

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

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is Unity can do stereo pairs 1 Answer

[stereoscopy] Parallax adjustment 0 Answers

How do you differentiate between pinch to zoom with two fingers and a two finger drag? 2 Answers

3D-audio-source limit 0 Answers

Active Stereoscopic 3D for Unity 1 Answer


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