What is the code for the player to collide with and trigger a music source to the player to hear as an Audio Source not at the current position. Because I am having difficulty making the player collide with the trigger and everything would work but there would be no direct sound for the player to listen to. SO if you could help I would really appreaciate it. ALOT!
asked Feb 27 '10 at 01:08 AM
I am not sure if this is what you wanted but here is what i got out of it, I decided to add comments to make things easier for you.
Also, i didn't put a comment in there for it, but on the Audio Source comopnet that is added, make sure you have it set to Loop, if you want it to loop that is.
Lastly, take a look at this for other Audio related scripting issues: Unity Scripting Reference: Audio Source
Hopefully i have helped out, good luck and have fun with Unity!!
answered Feb 28 '10 at 04:13 AM
Not sure if I understand your question, but if you want to start a jukebox when a player is entering the room the only thing you have to do is attach a trigger collider to the jukebox that contains the room or area where the music should be heard. Then OnTriggerEnter start the AudioSource. If the clip attached to the AudioSource is marked as a 3d sound the music's level will depend on the distance of the AudioListener (probably attached to your cam/player) to the AudioSource. If you don't want that disable the clip's 3d sound property.
answered Feb 27 '10 at 11:47 AM