diff --git a/public/static/fonts/Montserrat-Bold.ttf b/public/static/fonts/Montserrat-Bold.ttf new file mode 100644 index 0000000..4033587 Binary files /dev/null and b/public/static/fonts/Montserrat-Bold.ttf differ diff --git a/src/components/InteractiveObjects/ImageObject.js b/src/components/InteractiveObjects/ImageObject.js index 27c6906..98712ec 100644 --- a/src/components/InteractiveObjects/ImageObject.js +++ b/src/components/InteractiveObjects/ImageObject.js @@ -1,4 +1,4 @@ -import { TextureLoader, MeshStandardMaterial, MeshBasicMaterial, PlaneGeometry, Mesh } from "three"; +import { TextureLoader, MeshStandardMaterial, MeshBasicMaterial, PlaneGeometry, Mesh, DoubleSide } from "three"; import { assignParams } from "@/lib/MeshUtils"; class ImageObject { @@ -7,7 +7,8 @@ class ImageObject { var t = await engine.loadTexture(obj.value, obj.path) var mp = { map: t, - alphaTest: 0.5 + alphaTest: 0.5, + side: DoubleSide }; if (obj.nm) { mp.normalMap = new TextureLoader().setPath(obj.path).load(obj.nm); diff --git a/src/components/InteractiveObjects/MazeQuizGame/MazeObject.js b/src/components/InteractiveObjects/MazeQuizGame/MazeObject.js index b2c151b..d17b216 100644 --- a/src/components/InteractiveObjects/MazeQuizGame/MazeObject.js +++ b/src/components/InteractiveObjects/MazeQuizGame/MazeObject.js @@ -104,9 +104,13 @@ class MazeObject { addPhysics(def.matrix, [-tubeSize / 2, 0.6, offsetZ/2], offsetZ) addRoom(['floor', 'door', def.r ? 'door' : 'wall', def.f ? 'door' : 'wall', def.l ? 'door' : 'wall'], def, offsetZ) - if (def.userData?.qid !== undefined || def.userData?.finish || def.userData?.corner){ + if (def.userData?.qid !== undefined || def.userData?.finish){ addPhysics(def.matrix, [0,0,offsetZ + wallSize/2], { width: wallSize/2, height: wallSize/2, depth: wallSize/2}, 'side', true, def.userData) } + + if (def.userData?.corner){ + addPhysics(def.matrix, [0,0,-wallSize/2], { width: wallSize/2, height: wallSize/2, depth: wallSize/2}, 'side', true, {corner: def.userData.corner}) + } //console.log('loadingggg', def.objects) def.objects?.forEach(async obj => { obj.room = room; diff --git a/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js b/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js index ffe9154..0fb71d9 100644 --- a/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js +++ b/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js @@ -130,16 +130,18 @@ class MazeQuizGame extends EventDispatcher { dd = d == 'l' ? 'r' : 'l' } if (i == 0){ + let next = this.generate(questions, qid + 1, 3) + next.userData.corner = { question }; mo[d] = { - userData: { corner: { question }}, len: 4, - [dd]: this.generate(questions, qid + 1, 3) + [dd]: next } }else{ mo[d] = { - userData: { question, qid, answer: i, corner: { question, penalty: true } }, + userData: { question, qid, answer: i }, len: 4, [dd]: { + userData: { corner: { question, penalty: true } }, len: 2, objects:[ { @@ -155,10 +157,8 @@ class MazeQuizGame extends EventDispatcher { let path = mo[d][dd]; mo[d][dd] = { len: 1, - userData: mo[d].userData, [dd == 'r' ? 'l' : 'r']: path } - delete mo[d].userData; } } }) diff --git a/src/lib/Dashboard.js b/src/lib/Dashboard.js index d732a13..66a663d 100644 --- a/src/lib/Dashboard.js +++ b/src/lib/Dashboard.js @@ -106,9 +106,10 @@ class DashBoard { const pointsText = new Text() Object.assign(pointsText, { - text:``, fontSize: 0.044, font: '/static/fonts/Montserrat-Regular.ttf' + text:``, fontSize: 0.044, font: '/static/fonts/Montserrat-Bold.ttf', + outlineColor: 0x113377, outlineWidth: '3%', anchorX: 'center', }) - pointsText.position.set(0.88 * engine.aspect/2, 0.33, 0); + pointsText.position.set(0.86 * engine.aspect/2, 0.47, 0); dash.add(pointsText); engine.addEventListener('beforeRender', ()=>{ @@ -152,8 +153,21 @@ class DashBoard { this.addPoints = function(p){ points += p; - pointsText.text = points; - pointsText.sync(); + engine.motionQueue.add({ + o: pointsText, + a: {rotation:{y: Math.PI}, scale:{x:1.5, y:1.5, z:1.5}}, + t: 0.25, + f:()=>{ + pointsText.text = points; + pointsText.sync(); + engine.motionQueue.add({ + o: pointsText, + a: {rotation:{y: Math.PI*2}, scale:{x:1, y:1, z:1}}, + t: 0.5, + f: ()=>{pointsText.rotation.y = 0;} + }) + } + }) } this.enable = ()=>{