Premium Only Content
![Rogue Engine - Playing Sounds - In Two Minutes](https://1a-1791.com/video/s8/1/u/y/7/Z/uy7Zk.qR4e-small-Rogue-Engine-Playing-Sounds.jpg)
Rogue Engine - Playing Sounds - In Two Minutes
Rogue Engine enables you to attach a sound to an object in the scene.
So let's make an empty object and rename it.
We are going to create a new component to start the sound playing so, create a new Component asset and call it, Object Audio.
Now double click the component to open it in your code editor.
We need to reference the Three.js library at the top of the file as we want to add a property to the component that is a Three.Audio type.
The "true" parameter in the property indicates that this will be positional audio so that the sound will seem to come from the object in 3D space.
If we save our code and go back to the Rogue editor, we can drag and drop the component onto the Audio Background object. We will now see the objectAudio property we have defined is "unset".
So lets find some audio to go into this component. You can import an mp3 file into your asset panel and then drag and drop it into the objectAudio property.
Now we can go back to our code. We can make the audio play as soon as the scene is loaded by adding the following to the Start method.
First check that the objectAudio property has been set.
Then add the objectAudio to the object3D that this component is attached to.
We can set the audio to loop if we want to, then play the audio.
Save your code and go back to the Rogue editor. Now when we play our scene, the audio will play.
And that's how to attach audio to an object with Rogue Engine.
-
1:01:29
John Crump Live
5 hours agoMexico Backs Cartels By Threatening To Designate Gun Manufactures As Terrorist!
4.64K4 -
The Nunn Report - w/ Dan Nunn
3 hours ago[Ep 611] DOGE On The March! | Guest Sam Anthony - [your]NEWS | Seditious Dems | Ukraine
12.3K9 -
1:00:56
The Tom Renz Show
9 hours agoThe War On DOGE Is ALSO A War On The Economy
18.8K7 -
1:30:16
Steve-O's Wild Ride! Podcast
5 days ago $1.26 earnedAri Shaffir Exposes The Dark Side of Podcasting - Wild Ride #252
25.8K3 -
1:56:29
The Quartering
7 hours agoAirplane FLIPS and CRASHES, Sean Duffy Slams Pete Buttigieg, & What Happened with Patriarchy Hannah
78K36 -
37:08
Standpoint with Gabe Groisman
23 hours agoDOGE The UK?! With Liz Truss
41.3K15 -
56:39
SLS - Street League Skateboarding
6 days agoHIGHEST SCORING KNOCKOUT ROUND OF ALL TIME! Felipe Gustavo, Dashawn Jordan, Filipe Mota & more...
30.6K2 -
14:26
Breaking Points
1 day agoWOKE VS BASED?: Saagar And Ryan Play A Game
31.9K6 -
5:29:58
SoundBoardLord
8 hours agoThe Red Dead Journey Continues!!!
29.2K1 -
1:17:31
The Officer Tatum
4 hours agoLIVE: Delta Airlines CRASH BLAMED On Trump, Ashley St. Claire Had Elon's BABY? + More | Ep 63
35.7K39