Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 sanoj00 · Aug 24, 2012 at 01:37 PM · soundchangelocation

How can i make so one sound changes location?

I want a scary whisper sound to go around my character. Like starts at back, continues to the left, then front, then to the right. How can i do this? My character must also be able to move.

Comment
Add comment · Show 3
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 sanoj00 · Aug 24, 2012 at 05:34 PM 0
Share

Can someone help? :(

avatar image Mander · Aug 24, 2012 at 05:38 PM 0
Share

u might need to implement some kind of surround sound check this link

http://answers.unity3d.com/questions/195719/surround-quad-unity-with-four-speakers.html

avatar image Bunny83 · Aug 24, 2012 at 05:57 PM 0
Share

@sanoj00: I've converted your answer into a comment.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by fafase · Aug 24, 2012 at 05:42 PM

Create an empty game object and attach the audio source to it. You can move the game object like any other.

Here is a simple script that gets the player in a zone and the object will rotate around it for 10 seconds: -Create a trigger box and attach this:

 var onlyOne:boolean=true;
 function OnTriggerEnter(other:Collider){
 if(other.gameObject.tag=="Player")Create(other.gameObject.transform);}
 
 function Create(pos:Transform){
 if(onlyOne){
   var obj = Instantiate(prefab,pos.position,Quaternion.identity)
   obj.transform.parent = pos;
   onlyOne =false;
 }
 }

And on the prefab you have this script:

 var timer:float=10;
 function Update(){
 timer-=Time.deltaTime;
 if(timer>0)
 transform.position=Vector3(Mathf.Cos(2*Time.timeSinceLevelLoad),0,
     Mathf.Sin(2*Time.timeSinceLevelLoad));
 else Destroy(gameObject);
 }

Your prefab is a simple game object with an audio source and a audio clip with play on awake. When the player enters the zone the object will start spinning around him and follow him for 10 seconds.onlyOne makes sure the object does not get created many times.

Comment
Add comment · Show 3 · 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 sanoj00 · Aug 24, 2012 at 09:09 PM 0
Share

I tried, but i have no fucking idea of what you mean. This is too difficult.

avatar image fafase · Aug 24, 2012 at 09:46 PM 0
Share

Ok, let's start slowly. You place an empty game object in your scene then you add a box collider to it. This collider you set it to IsTrigger, that means you won't bounce on it but just get through it. The whole entity is not visible is an invisible sas. Now you have the first part attached as a script.

Previously, you prepare another empty game object, you add an audio source, the file you want to play (like"Bouhou you scared?") and in the AudioSource component you tick PlayOnAwake, that starts the audio file automatically. Then you attach the second script to it. Create a prefab and drag and drop that object,now remove it from the scene. In the first script back you add:

 var prefab:GameObject;

then you drag and drop the prefab you just made.

When your player will enter the sas, an invisble object because empty will start spinning around your player following him. As there is an audio source playing, the sound is moving around you, the player. Get it?

if you multiply the Cos and Sin with different values you get a more interesting effect of boomerang ins$$anonymous$$d of plane circle. your object disappears after 10s. (now you're scared).

I was thinking of animation and animatin event but I will probably get you lost.

Other way, to finish with this, you can have array of positions ins$$anonymous$$d of trig functions. your object is spinning around the player but jumping from one position to another in space.

Hope that clarify a little.

avatar image zaneofcawdor · Jul 07, 2014 at 04:05 PM 0
Share

I get the principle here, but theoretically is there any way to do this without having to manually create invisible game objects to control the transform of the audio sources? I want to do something along these lines with potentially every audio source in a scene, so ideally I want to be able to programmatically create empty game objects or similar to move audio sources as and when needed.. can this be done?

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

9 People are following this question.

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

Related Questions

Change sound location 0 Answers

change detail in game an the sound? 3 Answers

I want to change the object position random in five particular position only. 0 Answers

Changing sound when walking in different areas. 1 Answer

How to add two different sound in different location in a scene ? 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