Add Sound to Entities
Entities have the ability to add a collision sound, so that the entity will emit a sound every time it comes in contact, or collides, with another entity.
To add a sound:
- In Interface, pull up your Tablet or HUD and go to Create.
- Select the entity.
- In the Create app, click on 'Properties' and scroll down to the 'Collision' settings.
- Check the box for 'Collides', then enter the URL of the audio file for 'Collision Sound'.
Tutorial: Create a Bouncing Ball
In this example, we will walk through the steps to create a bouncing ball that emits a sound every time it hits a wall.
- Create a wall to bounce your ball off of.
a. Add a cube entity to your domain.
b. Resize the entity to approximately 10m wide, 10m high and 1m deep (X:10, Y:10, Z:1).
- Create a ball by adding a sphere entity to your domain. Optionally, change the color of your ball, so that it is different than your wall.
- In the Create app, click on 'Properties' and scroll down to the 'Collision' settings. Check the box for 'Collides' and 'Dynamic'.
- For 'Collision Sound', enter the URL of your sound file. The sound must be a .wav file, uncompressed, 48Khz, 16 bit. The URL can be either a web address, or an ATP reference to the assets on this domain server.
- Scroll down to the 'Physics' settings. Set the 'Gravity' for Y to -5. This will cause your ball to fall a little more slowly than things on earth (use -9.8 if you want that). Gravity is in units of m/s2.
As soon as you click off the ball, the gravity will cause the ball to fall downwards. When it hits the floor, it should stop or bounce a little and the sound should play.