This commit is contained in:
syuilo 2026-02-11 11:20:49 +09:00
commit e41e700f2d
4 changed files with 26 additions and 3 deletions

View file

@ -138,6 +138,11 @@ onMounted(() => {
type: 'plant2',
position: [135, 0, -135],
rotation: [0, 0, 0],
}, {
id: 's',
type: 'wall-clock',
position: [-150, 200, 100],
rotation: [0, 0, 0],
}],
}, {
canvas: canvas.value!,

View file

@ -7,8 +7,10 @@
* Roomで使われるオブジェクトの仕様
* -
* - (blenderならz)0
* - _COLLISION_TOP_
* - _COLLISION_TOP_ Array Modifierなどを適用した状態では正しく動作しません
* - X軸座標が0になるように設計すること
* - _COLLISION_TOP_
* - _COLLISION_SIDE_
* - _COLLISION_TOP_ / _COLLISION_SIDE_ Array Modifierなどを適用した状態では正しく動作しません
*/
import * as BABYLON from '@babylonjs/core';
@ -150,6 +152,22 @@ const OBJECTS = {
ps.start();
},
},
'wall-clock': {
placement: 'side',
onInit: (room, o, obj) => {
const hourHand = obj.meshes[0].getChildMeshes().find(m => m.name === 'HandH') as BABYLON.Mesh;
const minuteHand = obj.meshes[0].getChildMeshes().find(m => m.name === 'HandM') as BABYLON.Mesh;
room.intervalIds.push(window.setInterval(() => {
const now = new Date();
const hours = now.getHours() % 12;
const minutes = now.getMinutes();
const hAngle = -(hours / 12) * Math.PI * 2 - (minutes / 60) * (Math.PI * 2 / 12);
const mAngle = -(minutes / 60) * Math.PI * 2;
hourHand.rotation = new BABYLON.Vector3(hAngle, 0, 0);
minuteHand.rotation = new BABYLON.Vector3(mAngle, 0, 0);
}, 1000));
},
},
aircon: {
placement: 'side',
},
@ -298,7 +316,7 @@ export class RoomEngine {
private time: 0 | 1 | 2 = 2; // 0: 昼, 1: 夕, 2: 夜
private roomCollisionMeshes: BABYLON.AbstractMesh[] = [];
private def: RoomDef;
public enableGridSnapping = true;
public enableGridSnapping = false;
private putParticleSystem: BABYLON.ParticleSystem;
constructor(def: RoomDef, options: {