Wednesday 9 May 2012

Putting Sound in to Practice

I have already discussed the importance of sound in previous posts and how it can add as much to a game environment as physical assets. During a recent tutorial we visited this idea os creating a game space using  mainly just audio visuals. We explored various different ways of applying sound in Unity to create a game level with depth and interactivity. Bellow is the game level:




title>Unity Web Player | Sound_Room_lvl


function OnTriggerEnter()

{

audio.Play();

}




function OnTriggerExit()

{

audio.Stop();

}



With this, the mesh collider must be set to 'is trigger.' From experience this means the player no longer collides with the object so it is a good idea to have a separate invisible emitter if there is a visible object meant to be emitting the sound. The final application of sound we looked at was to have a sound play when an object collides with something. For this we applied a 'rigid body' from the component>Physics menu. This applies gravity to the object. To enable the player to interact with the object, the 'drag rigid body' script found in found in the components>scripts menu must be applied to the first person controller. The script to emit a sound on collision is:


function OnCollisionEnter()

{

audio.Play();

}

again the sound must not play on awake or loop. 

From the just the application of sound alone, you can almost envision this industrial mechanical environment. This enforces some of the points made in my Bioshock post. By taking away all of the visual qualities, I almost feel that sound is able to create the setting equally as well. Surely combining the two with equal thought and effort would result in a very well enforced vision.

No comments:

Post a Comment