mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 09:23:17 +02:00
minor cleanup of playSoundOrbit.js + playSound.js
This commit is contained in:
parent
848144d98c
commit
fd5e3d61dc
2 changed files with 6 additions and 6 deletions
|
@ -12,14 +12,14 @@
|
|||
var bird = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw");
|
||||
|
||||
function maybePlaySound(deltaTime) {
|
||||
// if (Math.random() < 0.01) {
|
||||
if (Math.random() < 0.01) {
|
||||
// Set the location and other info for the sound to play
|
||||
var options = new AudioInjectionOptions();
|
||||
var position = MyAvatar.position;
|
||||
options.position = position;
|
||||
options.volume = 0.5;
|
||||
Audio.playSound(bird, options);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Connect a call back that happens every frame
|
||||
|
|
|
@ -19,19 +19,19 @@ var debug = 0;
|
|||
function playSound() {
|
||||
var options = new AudioInjectionOptions();
|
||||
currentTime += deltaTime;
|
||||
|
||||
|
||||
var s = distance * Math.sin(currentTime);
|
||||
var c = distance * Math.cos(currentTime);
|
||||
|
||||
var soundOffset = { x:s, y:0, z:c };
|
||||
|
||||
|
||||
if( debug ) {
|
||||
print("t=" + currentTime + "offset=" + soundOffset.x + "," + soundOffset.y + "," + soundOffset.z);
|
||||
}
|
||||
|
||||
|
||||
var avatarPosition = MyAvatar.position;
|
||||
var soundPosition = Vec3.sum(avatarPosition,soundOffset);
|
||||
|
||||
|
||||
options.position = soundPosition
|
||||
options.volume = 1.0;
|
||||
Audio.playSound(soundClip, options);
|
||||
|
|
Loading…
Reference in a new issue