Thursday, 17 March 2011

Audio / Unity

Having looked at how to implement audio from tutorials, it was a relatively simple task to achieve. Importing the audio as an asset, then attaching it to a box collider from the physics drop down menu. At first i stretched the scale of the collider to the plane of the floor plan, which would have been ok if my character was a millimeter tall. But it bust encompass the area designated for the sound. So it soon became apparent that in a 3d space, the box collider had to encompass everything the 'first person' would come into contact with. As soon as this was in place i added this script to the script editor to enable the audio to be triggered when the player enters the room:

function onTriggerEnter()
{
audio.Play();
}

function onTriggerExit()
{
audio.Stop();
}

This now functions in unity properly and the sweeping midi samples work perfectly with the atmosphere.
A few more digital bits of sound surrounding some of the 'computer esq' objects within the level to add more dynamic.
I feel this will give the level a much more interactive quality, thus making it a more convincing and enjoyable playing environment.
I would like to make more of the 3d aspect of sound within the level, and add further dynamic using the 'roll off' parameter to effect.
Its a shame its a mission to get sound on blogger as i would have a demo up....

No comments:

Post a Comment