This commit is contained in:
syuilo 2026-06-02 17:43:20 +09:00
commit 8684cf14cc
3 changed files with 33 additions and 0 deletions

View file

@ -14,6 +14,7 @@
// TODO: pure barrel importが機能しない問題をbabylonに報告
// TODO: meshをdiposeした際、scene.meshesやshadowmapのrenderlistからも明示的に削除しないとメモリリークするのかどうかbabylonのforumで尋ねる
// TODO: 起動時、ひとつでもcustom imageの読み込みに失敗したら「一部の画像を読み込めませんでした」を出す
// TODO: 座ると一升瓶のマテリアルがおかしくなる現象をbabylonに報告
import * as BABYLON from '@babylonjs/core';
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic';
@ -1157,6 +1158,26 @@ export class RoomEngine extends EngineBase<{
this.selectFuniture(null);
}
public sit() {
this.isSitting = true;
this.sr.disableSnapshotRendering();
this.fixedCamera.parent = null;
this.fixedCamera.position = new BABYLON.Vector3(this.camera.position.x, cm(80), this.camera.position.z);
this.fixedCamera.rotation = new BABYLON.Vector3(this.camera.rotation.x, this.camera.rotation.y, this.camera.rotation.z);
this.scene.activeCamera = this.fixedCamera;
this.sr.enableSnapshotRendering();
}
public lyingDown() {
this.isSitting = true;
this.sr.disableSnapshotRendering();
this.fixedCamera.parent = null;
this.fixedCamera.position = new BABYLON.Vector3(this.camera.position.x, cm(20), this.camera.position.z);
this.fixedCamera.rotation = new BABYLON.Vector3(-(Math.PI / 2) + 0.001, this.camera.rotation.y, this.camera.rotation.z);
this.scene.activeCamera = this.fixedCamera;
this.sr.enableSnapshotRendering();
}
public standUp() {
this.isSitting = false;
this.scene.activeCamera = this.camera;

View file

@ -599,10 +599,14 @@ function showCharacterMenu(ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts._miWorld.sit,
action: () => {
controller.sit();
canvas.value!.focus();
},
}, {
text: i18n.ts._miWorld.lyingDown,
action: () => {
controller.lyingDown();
canvas.value!.focus();
},
}], ev.currentTarget ?? ev.target);
}

View file

@ -222,6 +222,14 @@ export class RoomController extends EngineControllerBase<RoomEngine, {
this.call('interact', [this.selected.value!.furnitureId, id]);
}
public sit() {
this.call('sit');
}
public lyingDown() {
this.call('lyingDown');
}
public standUp() {
this.call('standUp');
}