1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-19 20:35:34 +02:00
This commit is contained in:
syuilo
2026-05-01 11:54:52 +09:00
parent 7df4b729e9
commit d1eda166de
3 changed files with 17 additions and 6 deletions

View File

@@ -15,7 +15,7 @@
import * as BABYLON from '@babylonjs/core';
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic';
import { EventEmitter } from 'eventemitter3';
import { TIME_MAP, scaleMorph, camelToKebab, cm, WORLD_SCALE, getMeshesBoundingBox, Timer, getYRotationDirection, FreeCameraManualInput } from '../utility.js';
import { TIME_MAP, scaleMorph, camelToKebab, cm, WORLD_SCALE, getMeshesBoundingBox, Timer, getYRotationDirection, FreeCameraManualInput, remap } from '../utility.js';
import { getObjectDef } from './object-defs.js';
import { findMaterial, ModelManager, SYSTEM_HEYA_MESH_NAMES, SYSTEM_MESH_NAMES } from './utility.js';
import { SimpleHeyaManager } from './heya.js';
@@ -40,6 +40,7 @@ export type RoomState = {
};
roomLightColor: [number, number, number];
installedObjects: RoomStateObject<any>[];
worldScale: number;
};
function mergeMeshes(meshes: BABYLON.Mesh[], root: BABYLON.Mesh, hasTexture: boolean) {
@@ -454,7 +455,7 @@ export class RoomEngine extends EventEmitter {
await Promise.all(objects.map(o => this.loadObject({
id: o.id,
type: o.type,
position: new BABYLON.Vector3(...o.position),
position: this.roomState.worldScale !== WORLD_SCALE ? new BABYLON.Vector3(remap(o.position[0], 0, this.roomState.worldScale, 0, WORLD_SCALE), remap(o.position[1], 0, this.roomState.worldScale, 0, WORLD_SCALE), remap(o.position[2], 0, this.roomState.worldScale, 0, WORLD_SCALE)) : new BABYLON.Vector3(...o.position),
rotation: new BABYLON.Vector3(o.rotation[0], o.rotation[1], o.rotation[2]),
options: o.options,
}).then(() => {

View File

@@ -5,10 +5,13 @@
import * as BABYLON from '@babylonjs/core';
export const WORLD_SCALE = 1;
// ベクトルが小さいと動きが不自然になったりするので大きくする
// https://forum.babylonjs.com/t/the-camera-isnt-moving-correctly-in-my-custom-input/63286/2
export const WORLD_SCALE = 100;
// cm to meter. 二重に適用しないように注意すること。
export const cm = (value: number) => value / 100;
//// cm to meter. 二重に適用しないように注意すること。
//export const cm = (value: number) => value / 100;
export const cm = (value: number) => value;
export const TIME_MAP = {
0: 2,