add sound ambiance

This commit is contained in:
2023-05-31 12:27:31 +02:00
parent 2688ab2e9a
commit ed87833848
2 changed files with 7 additions and 1 deletions

BIN
ambiance.mp3 Normal file

Binary file not shown.

View File

@ -70,6 +70,9 @@ const mazeWidth = 51
let showGUI = window.location.search.includes("debug")
let showStats = window.location.search.includes("stats")
const ambiance = new Audio("ambiance.mp3")
ambiance.loop = true
const loadMngr = new THREE.LoadingManager();
const loader = new THREE.TextureLoader(loadMngr);
const waterTexture = loader.load('img/waternormals.jpg');
@ -117,6 +120,7 @@ const water = new Water(
);
water.rotation.x = - Math.PI / 2;
water.position.y = -.01
water.receiveShadow = true;
scene.add( water );
// Ground
@ -166,6 +170,7 @@ const raft = new THREE.Mesh( raftGeometry, raftMaterial )
raft.position.set( mazeLength/2 + .2, 0, -1 )
raft.rotation.y = 1.4
raft.rotation.order = 'ZXY';
raft.castShadow = true;
scene.add(raft)
worldOctree.fromGraphNode( raft )
raftOctree.fromGraphNode( raft )
@ -415,6 +420,7 @@ document.addEventListener( 'keyup', ( event ) => {
container.addEventListener( 'mousedown', () => {
document.body.requestPointerLock();
ambiance.play()
} );