mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +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 objectId = Entities.addEntity(properties);
|
||||||
var soundOptions = { position: orbitCenter, loop: true, volume: 0.5 };
|
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;
|
time += deltaTime;
|
||||||
currentPosition = { x: orbitCenter.x + Math.cos(time * SPEED) * RADIUS, y: orbitCenter.y, z: orbitCenter.z + Math.sin(time * SPEED) * RADIUS };
|
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;
|
trailingLoudness = 0.9 * trailingLoudness + 0.1 * sound.loudness;
|
||||||
|
|
Loading…
Reference in a new issue