video player as interactive object + move to HUD

This commit is contained in:
2025-11-03 14:07:17 +02:00
parent d8618c69f4
commit b1e27301b4
7 changed files with 134 additions and 52 deletions
@@ -10,6 +10,7 @@ import { PuzzleGame4 } from "./PuzzleGame4";
// import { Game6 } from "./games/Game6";
import { TextObject } from "./TextObject";
import { ImageObject } from "./ImageObject";
import { VideoPlayer } from "./VideoPlayer";
const games = {PuzzleGame1, PuzzleGame2, PuzzleGame4};
@@ -18,7 +19,7 @@ class InteractiveObject {
this.name = obj.name;
this.ready = new Promise((resolve, reject) => {
let mesh;
switch (obj.type) {
switch (obj.id) {
case 'group':
mesh = new Group();
obj.group.forEach(g => {
@@ -48,7 +49,7 @@ class InteractiveObject {
resolve(mesh);
break;
case 'gltf':
console.log('loadingg', obj.value)
//console.log('loadingg', obj.value)
new GLTFLoader().load(obj.value, (gltf) => {
let gltfObj = gltf.scene;
gltf.scene.traverse(function (object) {
@@ -81,11 +82,15 @@ class InteractiveObject {
case 'PuzzleGame4':
case 'PuzzleGame5':
case 'PuzzleGame6':
var game = new games[obj.type](context, obj.args[0], obj.args[1], obj.args[2]);
let game = new games[obj.type](context, obj.args[0], obj.args[1], obj.args[2]);
mesh = game.object;
mesh.game = game;
resolve(mesh);
break;
case 'VideoPlayer':
let vp = new VideoPlayer(context, `/asset/default/${obj.$go.asset.name}`);
vp.ready.then(resolve);
break;
}
});
this.ready.then((mesh) => {
@@ -137,6 +142,6 @@ const InteractiveObjectTypes = [
}, {
id: 'VideoPlayer', name: 'Video Player'
}
]
];
export { InteractiveObject, InteractiveObjectTypes }