Premium Only Content
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.
-
LIVE
Eternal_Spartan
3 hours ago🟢 Eternal Spartan Plays Arc Raiders - New Updates! | USMC Veteran
59 watching -
LIVE
CODZombieGod115
8 hours ago $0.04 earned🟢 Live - Ashes Of The Damned Round 100 Attemp or Easter Egg Attempt! Black ops 7 Zombies
46 watching -
DVR
Mally_Mouse
1 day ago🔥🍺Spicy HYDRATE Saturday!🍺🔥-- Let's Play: Cuff Bust
32.7K2 -
2:06:12
SavageJayGatsby
9 hours ago🔥🌶 Spicy Saturday – Cuff Bust Chaos! 🌶 🔥
22.2K -
58:35
WanderingWithWine
4 days ago $3.49 earnedLive in FLORENCE ITALY for €80k? | 6 Houses For Sale in Italy
9.92K3 -
1:02:05
Live From The Casita
1 hour ago $0.25 earnedLive Music Jam
2.07K -
3:45
Gun Drummer
13 hours agoThree Days Grace - I Hate Everything About You (GUN COVER)
9.3K2 -
LIVE
DeadMomAlive
4 hours agoSatur-SLAY Face Paint! MEOW! Black Slops 7 with da CREW! BIRTHDAY MONTH!
58 watching -
3:04:12
Wokkopotamus
3 hours ago $0.54 earnedIts Random Saturday night come hang out with Wokko , Livestream !
3.97K -
17:53
Exploring With Nug
12 hours ago $5.25 earnedROV Grabber Arm Training: Improving Accuracy in Murky Lake Conditions
46K1