mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 21:02:17 +02:00
wait for sound to download
This commit is contained in:
parent
25671fbefe
commit
9a3972c43f
1 changed files with 8 additions and 2 deletions
|
@ -28,9 +28,15 @@ var properties = {
|
|||
|
||||
var objectId = Entities.addEntity(properties);
|
||||
var soundOptions = { position: orbitCenter, loop: true, volume: 0.5 };
|
||||
var sound = Audio.playSound(soundClip, soundOptions);
|
||||
var sound;
|
||||
|
||||
function update(deltaTime) {
|
||||
function update(deltaTime) {
|
||||
if (!soundClip.downloaded) {
|
||||
return;
|
||||
}
|
||||
if (!sound) {
|
||||
sound = Audio.playSound(soundClip, soundOptions); // Not until downloaded
|
||||
}
|
||||
time += deltaTime;
|
||||
currentPosition = { x: orbitCenter.x + Math.cos(time * SPEED) * RADIUS, y: orbitCenter.y, z: orbitCenter.z + Math.sin(time * SPEED) * RADIUS };
|
||||
trailingLoudness = 0.9 * trailingLoudness + 0.1 * sound.loudness;
|
||||
|
|
Loading…
Reference in a new issue