This commit is contained in:
@@ -75,26 +75,18 @@ export default{
|
||||
engine.ambientLight.intensity = 25;
|
||||
if (this.obj.type == 'panorama2d') {
|
||||
await engine.loadPanorama(this.obj.asset.name);
|
||||
// let t = await engine.loadTexture(`/asset/default/${this.obj.asset.name}`);
|
||||
// t.mapping = engine.$.EquirectangularReflectionMapping;
|
||||
// engine.scene.background = t;
|
||||
// engine.scene.environment = t;
|
||||
// engine.scene.add(engine.camera);
|
||||
} else {
|
||||
let gltf = await engine.load(this.obj.asset.name);
|
||||
//console.debug('GLTF', gltf);
|
||||
this.loadedAsset = gltf;
|
||||
this.animations = gltf.animations.map(a => ({
|
||||
name: a.name, id: a.uuid
|
||||
}));
|
||||
autoScale(gltf.scene);
|
||||
let bb = new engine.$.Box3().setFromObject(gltf.scene);
|
||||
//console.log(bb)
|
||||
engine.camera.position.set(bb.max.x, bb.max.y, bb.max.z*3);
|
||||
engine.orbitControls.target.set((bb.max.x + bb.min.x) / 2, (bb.max.y + bb.min.y) / 2, (bb.max.z + bb.min.z) / 2)
|
||||
engine.orbitControls.update();
|
||||
engine.activeObjects.add(gltf.scene);
|
||||
//engine.scene.add(engine.light);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -43,8 +43,8 @@ class MazeQuizGame extends EventManager {
|
||||
super();
|
||||
this.data = data;
|
||||
data.noPhysics = true;
|
||||
params.mazeFile = data.style || 'quiz-s2.gltf';
|
||||
params.io = this;
|
||||
|
||||
this.params = { ...params, mazeFile: data.style || 'quiz-s2.gltf', io: this }
|
||||
|
||||
this.maxPoints = (data.points || 0) + (data.questionPoints||0) * data.questions.length;
|
||||
this.minPoints = this.maxPoints - (data.questionPenalty||0) * data.questions.length;
|
||||
@@ -52,7 +52,7 @@ class MazeQuizGame extends EventManager {
|
||||
return new Promise(async (resolve, reject)=>{
|
||||
let questions = data.shuffle ? Utils.shuffleArray(data.questions) : data.questions;
|
||||
let def = this.generate(questions);
|
||||
this.mazeObject = new MazeObject(engine, def, params)
|
||||
this.mazeObject = new MazeObject(engine, def, this.params)
|
||||
engine.addEventListener('collision', async e=>{
|
||||
let ud1 = engine.physics.world.getCollider(e.handle1)?.parent()?.userData,
|
||||
ud2 = engine.physics.world.getCollider(e.handle2)?.parent()?.userData;
|
||||
@@ -124,7 +124,7 @@ class MazeQuizGame extends EventManager {
|
||||
{
|
||||
type: 'SceneSwitcher', switchScene: this.data.switchScene, switchType: this.data.switchType,
|
||||
position:[0,.22,len + .52], scale: [0.33, 0.33, 0.33],
|
||||
distance: params.wallSize*4
|
||||
distance: this.params.wallSize*4
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user