physics
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GameEngine } from '@/lib/gameEngine.js';
|
||||
import { GameEngine } from '@/lib/GameEngine.js';
|
||||
let gameEngine = null;
|
||||
|
||||
export default{
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import { GameEngine } from '@/lib/gameEngine';
|
||||
import { GameEngine } from '@/lib/GameEngine';
|
||||
|
||||
let gameEngine = null;
|
||||
|
||||
@@ -150,6 +150,7 @@ export default {
|
||||
*/
|
||||
async loadEnvironment(scene, target){
|
||||
//await gameEngine.loadPanorama(`/asset/default/43.webp`);
|
||||
gameEngine.activeObjects.clear();
|
||||
await this.expandScenarioData(scene);
|
||||
target.objects = target.objects || {};
|
||||
let l = target.objects;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<v-btn-toggle variant="tonal" v-model="store.prefs.xr.depthSense" class="ma-3" density="comfortable" color="green-darken-2">
|
||||
<v-btn :value="true" icon="mdi-cube-outline"></v-btn>
|
||||
</v-btn-toggle>
|
||||
<v-btn icon="mdi-walk" @click="control"></v-btn>
|
||||
</v-navigation-drawer>
|
||||
<div class="container my-3 position-relative game-designer-canvas">
|
||||
<div ref="target" @click="targetClick" @pointerdown="targetPointerDown"></div>
|
||||
@@ -50,7 +51,8 @@
|
||||
|
||||
<script>
|
||||
|
||||
import { GameEngine } from '@/lib/gameEngine';
|
||||
import { GameEngine } from '@/lib/GameEngine';
|
||||
import { Hero } from '@/lib/Hero';
|
||||
import { useAppStore } from '@/stores/app';
|
||||
|
||||
const store = useAppStore();
|
||||
@@ -152,6 +154,7 @@ export default {
|
||||
//await gameEngine.loadPanorama(`/asset/default/43.webp`);
|
||||
await this.expandScenarioData(scene);
|
||||
//gameEngine.activeObjects.scale.set(0.033, 0.033, 0.033)
|
||||
gameEngine.activeObjects.clear();
|
||||
target.objects = target.objects || {};
|
||||
let l = target.objects;
|
||||
if (this.scene.data.$environment.type == 'panorama2d'){
|
||||
@@ -165,6 +168,10 @@ export default {
|
||||
let gltf = await gameEngine.load(`/asset/default/${i.data.$go.asset.name}`);
|
||||
this.setObjectAttributes(l, i.data, gltf, 10);
|
||||
gameEngine.activeObjects.add(gltf.scene);
|
||||
if (i.data.$go.type == 'player3d'){
|
||||
let hero = new Hero(gltf, i.data.$go);
|
||||
hero.init(gameEngine);
|
||||
}
|
||||
//console.log(JSON.stringify(l));
|
||||
//window.gameEngine = gameEngine;
|
||||
//console.log(new gameEngine.$.Euler({"isEuler":true,"_x":0,"_y":0,"_z":0,"_order":"XYZ"}));
|
||||
@@ -221,6 +228,10 @@ export default {
|
||||
gameEngine.resize(r.clientWidth, r.clientHeight);
|
||||
//this.zoom = Math.min(r.clientWidth / this.viewBox.w, r.clientHeight / this.viewBox.h);
|
||||
},
|
||||
|
||||
control(){
|
||||
gameEngine.hero.lockControls();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user