enhance gamedesigner objects management (selection)

This commit is contained in:
2026-04-14 18:30:59 +03:00
parent 4a36635836
commit be360a51b8
3 changed files with 18 additions and 3 deletions
+16 -2
View File
@@ -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
}));
@@ -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){
@@ -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:{