diff --git a/packages/frontend/assets/room/objects/wood-sound-absorbing-panel/wood-sound-absorbing-panel.blend b/packages/frontend/assets/room/objects/wood-sound-absorbing-panel/wood-sound-absorbing-panel.blend new file mode 100644 index 0000000000..456d3c90a7 Binary files /dev/null and b/packages/frontend/assets/room/objects/wood-sound-absorbing-panel/wood-sound-absorbing-panel.blend differ diff --git a/packages/frontend/assets/room/objects/wood-sound-absorbing-panel/wood-sound-absorbing-panel.glb b/packages/frontend/assets/room/objects/wood-sound-absorbing-panel/wood-sound-absorbing-panel.glb new file mode 100644 index 0000000000..6fad8b0f95 Binary files /dev/null and b/packages/frontend/assets/room/objects/wood-sound-absorbing-panel/wood-sound-absorbing-panel.glb differ diff --git a/packages/frontend/src/pages/room.vue b/packages/frontend/src/pages/room.vue index f0412637a9..f631f1f253 100644 --- a/packages/frontend/src/pages/room.vue +++ b/packages/frontend/src/pages/room.vue @@ -10,13 +10,14 @@ SPDX-License-Identifier: AGPL-3.0-only Toggle Light Edit mode: {{ engine.isEditMode.value ? 'on' : 'off' }} + 降りる (Q) @@ -172,6 +173,11 @@ onMounted(() => { type: 'wall-clock', position: [-150, 200, 100], rotation: [0, -Math.PI / 2, 0], + }, { + id: 's2', + type: 'wood-sound-absorbing-panel', + position: [-150, 140, 80], + rotation: [0, -Math.PI / 2, 0], }, { id: 't', type: 'book', diff --git a/packages/frontend/src/utility/room/engine.ts b/packages/frontend/src/utility/room/engine.ts index 197a018fa7..2bb6957492 100644 --- a/packages/frontend/src/utility/room/engine.ts +++ b/packages/frontend/src/utility/room/engine.ts @@ -302,6 +302,9 @@ const OBJECTS = { 'round-rug': { placement: 'floor', }, + 'wood-sound-absorbing-panel': { + placement: 'side', + }, } as Record; const _assumedFramesPerSecond = 60; @@ -711,8 +714,8 @@ export class RoomEngine { ev.stopPropagation(); if (this.isEditMode.value) { this.toggleGrab(); - } else { - this.interact(); + } else if (this.selectedObjectId != null) { + this.interact(this.selectedObjectId); } } else if (ev.code === 'KeyR') { ev.preventDefault(); @@ -720,6 +723,12 @@ export class RoomEngine { if (this.grabbing != null) { this.grabbing.rotation += Math.PI / 8; } + } else if (ev.code === 'KeyQ') { + ev.preventDefault(); + ev.stopPropagation(); + if (this.isSitting.value) { + this.standUp(); + } } }); @@ -1244,28 +1253,31 @@ export class RoomEngine { }); } - private interact() { - if (this.selectedObjectId == null) return; - - const o = this.def.objects.find(o => o.id === this.selectedObjectId)!; + private interact(oid: string) { + const o = this.def.objects.find(o => o.id === oid)!; const mesh = this.objectMeshs.get(o.id)!; const objDef = OBJECTS[o.type]; if (objDef.isChair) { - if (this.isSitting.value) { - this.isSitting.value = false; - this.scene.activeCamera = this.camera; - this.fixedCamera.parent = null; - } else { - this.isSitting.value = true; - this.fixedCamera.parent = this.objectMeshs.get(o.id); - this.fixedCamera.position = new BABYLON.Vector3(0, 120/*cm*/, 0); - this.fixedCamera.rotation = new BABYLON.Vector3(0, 0, 0); - this.scene.activeCamera = this.fixedCamera; - } + this.sitChair(o.id); } } + public sitChair(objectId: string) { + this.isSitting.value = true; + this.fixedCamera.parent = this.objectMeshs.get(objectId); + this.fixedCamera.position = new BABYLON.Vector3(0, 120/*cm*/, 0); + this.fixedCamera.rotation = new BABYLON.Vector3(0, 0, 0); + this.scene.activeCamera = this.fixedCamera; + this.selectObject(null); + } + + public standUp() { + this.isSitting.value = false; + this.scene.activeCamera = this.camera; + this.fixedCamera.parent = null; + } + private turnOnRoomLight() { this.roomLight.intensity = 300000; this.envMapIndoor.level = 0.3;