diff --git a/src/components/GameDesigner/GameDesigner.vue b/src/components/GameDesigner/GameDesigner.vue index 3bd4090..d53c33e 100644 --- a/src/components/GameDesigner/GameDesigner.vue +++ b/src/components/GameDesigner/GameDesigner.vue @@ -78,6 +78,7 @@ import { GameEngine } from '@/lib/GameEngine'; import { GameManager } from '@/lib/GameManager'; import { markRaw, computed } from 'vue'; +import { Vector3, Matrix4, Quaternion } from 'three'; import Utils from '#/app/Utils'; let engine = null, manager = null; @@ -113,6 +114,8 @@ export default { stats: true, mode: 'GameDesigner' }); + engine.perspectiveCamera.far = 1000; + engine.perspectiveCamera.updateProjectionMatrix(); const that = this; ['x', 'y', 'z'].forEach(c=>{ this.rotation[c] = computed({ @@ -228,8 +231,19 @@ export default { this.currentObject = this.flatObjects[oid]?.value; this.selectedObject = [oid]; engine.transformControls.attach(this.currentObject.__o); - engine.gizmo.target = this.currentObject.position; - engine.camera.updateProjectionMatrix(); + let position = new Vector3(), quat = new Quaternion(); + let mtx = new Matrix4(); + this.currentObject.__o.getWorldPosition(position); + engine.orbitControls.target.copy(position); + engine.gizmo.target.copy(position); + mtx.lookAt(engine.camera.position, position, engine.camera.up); + quat.setFromRotationMatrix(mtx); + engine.motionQueue.add({ + o: engine.camera, + a: {quaternion: { x: quat.x, y:quat.y, z: quat.z, w: quat.w } }, + t: 0.5 + }) + //engine.camera.updateProjectionMatrix(); this.objectAnimations = this.currentObject?.__animations?.map(a => ({ name: a.name, id: a.uuid, a })); diff --git a/src/components/InteractiveObjects/GenericObject/GenericObject.js b/src/components/InteractiveObjects/GenericObject/GenericObject.js index 085a35a..bdc3c44 100644 --- a/src/components/InteractiveObjects/GenericObject/GenericObject.js +++ b/src/components/InteractiveObjects/GenericObject/GenericObject.js @@ -29,7 +29,7 @@ class GenericObject extends EventManager{ }) } - if (!data.exclude){ + if (!data.exclude && (data.hud || data.description)){ engine.clickable.add(this.object, async e=>{ this.object.__onhud = !this.object.__onhud; if (engine.dashboard){ diff --git a/src/components/InteractiveObjects/GenericObject/GenericObject.vue b/src/components/InteractiveObjects/GenericObject/GenericObject.vue index 6c2a5a6..b89a4d2 100644 --- a/src/components/InteractiveObjects/GenericObject/GenericObject.vue +++ b/src/components/InteractiveObjects/GenericObject/GenericObject.vue @@ -28,6 +28,7 @@ export default { }, mounted(){ this.active = true; + this.modelValue.collisionType ??= 'objectDefinied'; this.collisionTypes = Object.keys(this.l.collisionTypes).map(t=>({title: this.l.collisionTypes[t], value: t})) }, props:{