Skip to content

Commit

Permalink
ambient sound, 3D model
Browse files Browse the repository at this point in the history
  • Loading branch information
giulioprisco committed May 22, 2024
1 parent b3c40e5 commit 49ffa7b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
Binary file added assets/3D/spacex_starship_ship_s25__booster_9.glb
Binary file not shown.
19 changes: 11 additions & 8 deletions behaviors/default/ambientSound.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,19 @@ class AmbientSoundPawn extends PawnBehavior {
});
}

start(){
if(/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
return; // no audio for you
start() {
let yesAudio = true;
if(/webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
yesAudio = false;
}

console.log("AUDIO PLAY?", /(iPad|iPhone|iPod)/g.test( navigator.userAgent ))
this.audio = new Audio(this.file);
this.audio.loop = this.loop;
this.audio.volume = this.volume;
this.play();
console.log("AUDIO PLAY?", yesAudio);
if (yesAudio) {
this.audio = new Audio(this.file);
this.audio.loop = this.loop;
this.audio.volume = this.volume;
this.play();
}
if (this.handler) {
document.removeEventListener('click', this.handler);
delete this.handler;
Expand Down
25 changes: 24 additions & 1 deletion worlds/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,11 @@ export function init(Constants) {
modelType: "glb",
shadow: false,
singleSided: true, type: "3d",
attribution: "G4AGamingLabs at sketch fab",
}
},


/*
{
card: {
name: "space launch system",
Expand All @@ -214,7 +215,29 @@ export function init(Constants) {
shadow: true,
singleSided: true,
type: "3d",
attribution: "clarence365 at sketch fab",
}
},
*/

{
card: {
name: "spacex starship",
translation: [-175, -5, -100],
scale: [1, 1, 1],
rotation: [0, 0, 0, 0],
layers: ["pointer", "walk"],
name: "/spacex_starship_ship_s25__booster_9.glb",
dataLocation: "./assets/3D/spacex_starship_ship_s25__booster_9.glb",
dataScale: [1, 1, 1],
fileName: "/spacex_starship_ship_s25__booster_9.glb",
modelType: "glb",
shadow: true,
singleSided: true,
type: "3d",
attribution: "clarence365 at sketch fab",

}
},
Expand Down

0 comments on commit 49ffa7b

Please sign in to comment.