video player as interactive object + move to HUD
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { InteractiveObject } from '@/components/InteractiveObjects/InteractiveObject';
|
||||
import { GameEngine } from '@/lib/GameEngine';
|
||||
import { Hero } from '@/lib/Hero';
|
||||
let gameEngine = null;
|
||||
@@ -13,8 +14,12 @@ export default {
|
||||
designMode: this.env == 'GameDesigner',
|
||||
depthSense: this.env == 'GameDesigner' ? false : this.store.prefs.xr.depthSense
|
||||
});
|
||||
gameEngine.scene.add(gameEngine.transformControls.getHelper());
|
||||
//gameEngine.scene.add(new gameEngine.$.GridHelper(100,100));
|
||||
if (this.env == 'GameDesigner'){
|
||||
gameEngine.scene.add(gameEngine.transformControls.getHelper());
|
||||
}else{
|
||||
gameEngine.dashboard.enable();
|
||||
}
|
||||
this.resize();
|
||||
//gameEngine.setCamera(gameEngine.orthographicCamera)
|
||||
//gameEngine.setCameraOrthographic();
|
||||
@@ -63,10 +68,11 @@ export default {
|
||||
await this.loadScenario()
|
||||
},
|
||||
currentObject(n){
|
||||
gameEngine.transformControls.attach(n.__o);
|
||||
gameEngine.gizmo.target = n.__o.position;
|
||||
//gameEngine.camera.lookAt(n.__o.position)
|
||||
gameEngine.camera.updateProjectionMatrix()
|
||||
if (this.env == 'GameDesigner'){
|
||||
gameEngine.transformControls.attach(n.__o);
|
||||
gameEngine.gizmo.target = n.__o.position;
|
||||
gameEngine.camera.updateProjectionMatrix()
|
||||
}
|
||||
},
|
||||
renderType(v){
|
||||
gameEngine.renderType = v;
|
||||
@@ -124,7 +130,11 @@ export default {
|
||||
}
|
||||
for (let i of this.scene.data.items || []) {
|
||||
if (i.data.io){
|
||||
|
||||
i.data.$io = new InteractiveObject(i.data.io, gameEngine)
|
||||
i.data.$io.ready.then(o=>{
|
||||
this.setObjectAttributes(l, i.data, { scene: o }, 1);
|
||||
gameEngine.activeObjects.add(o);
|
||||
})
|
||||
}else{
|
||||
let gltf = await gameEngine.load(`/asset/default/${i.data.$go.asset.name}`);
|
||||
this.setObjectAttributes(l, i.data, gltf, 1);
|
||||
@@ -156,17 +166,21 @@ export default {
|
||||
this.pointerDownTime = performance.now();
|
||||
},
|
||||
targetClick(e){
|
||||
if (performance.now() - this.pointerDownTime < 200){
|
||||
let intersects = gameEngine.intersect(e, this.$refs.target, gameEngine.activeObjects.children, true);
|
||||
//console.log(intersects)
|
||||
if (intersects.length){
|
||||
//console.log('attaching controls to', intersects[0].object)
|
||||
//gameEngine.transformControls.attach(intersects[0].object);
|
||||
console.log(this.sceneObjects[intersects[0].object.__pn_id])
|
||||
this.objectsList[0] = this.sceneObjects[intersects[0].object.__pn_id]
|
||||
}else{
|
||||
gameEngine.transformControls.detach();
|
||||
if (this.env == 'GameDesigner'){
|
||||
if (performance.now() - this.pointerDownTime < 200){
|
||||
let intersects = gameEngine.intersect(e, this.$refs.target, gameEngine.activeObjects.children, true);
|
||||
//console.log(intersects)
|
||||
if (intersects.length){
|
||||
//console.log('attaching controls to', intersects[0].object)
|
||||
//gameEngine.transformControls.attach(intersects[0].object);
|
||||
//console.log(this.sceneObjects[intersects[0].object.__pn_id])
|
||||
this.objectsList[0] = this.sceneObjects[intersects[0].object.__pn_id]
|
||||
}else{
|
||||
gameEngine.transformControls.detach();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
gameEngine.onClick(e, this.$refs.target);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user