From eeae06014ab83a64124123c9abb3b52dde5767c6 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sat, 11 Apr 2026 11:35:33 +0900 Subject: [PATCH] Update randomBooks.ts --- .../src/utility/room/objects/randomBooks.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/utility/room/objects/randomBooks.ts b/packages/frontend/src/utility/room/objects/randomBooks.ts index b0b0ab4c56..f515585898 100644 --- a/packages/frontend/src/utility/room/objects/randomBooks.ts +++ b/packages/frontend/src/utility/room/objects/randomBooks.ts @@ -28,13 +28,17 @@ export const randomBooks = defineObject({ placement: 'top', createInstance: ({ options, model, scene }) => { const bodyMesh = model.findMesh('__X_BODY__'); - const tex = new BABYLON.Texture('/client-assets/room/objects/random-books/texture.png', scene, false, false); + const tex = new BABYLON.Texture('/client-assets/room/objects/random-books/texture.png', scene, { + invertY: false, + samplingMode: BABYLON.Texture.NEAREST_SAMPLINGMODE, + }); bodyMesh.material.albedoTexture = tex; const TEXTURE_DIVISION = 8; const count = 10; let accumulatedPos = 0; + const meshes: BABYLON.Mesh[] = []; for (let i = 0; i < count; i++) { const mesh = bodyMesh.clone(); @@ -56,14 +60,21 @@ export const randomBooks = defineObject({ mesh.updateVerticesData(BABYLON.VertexBuffer.UVKind, uvs); const width = randomRange(0.1, 0.2); - const height = randomRange(0.2, 0.4); + const height = randomRange(0.3, 0.4); const thickness = randomRange(0, 0.03); mesh.morphTargetManager!.getTargetByName('Width')!.influence = width; mesh.morphTargetManager!.getTargetByName('Height')!.influence = height; mesh.morphTargetManager!.getTargetByName('Thickness')!.influence = thickness; const thicknessCm = 2 + remap(thickness, 0, 1, 0, 100); - mesh.position.x = (accumulatedPos + 0.25) / WORLD_SCALE; - accumulatedPos += thicknessCm + 0.25; + const gap = 0.25; + mesh.position.x = (accumulatedPos + (thicknessCm / 2)) / WORLD_SCALE; + accumulatedPos += thicknessCm + gap; + meshes.push(mesh); + } + + // centering + for (let i = 0; i < count; i++) { + meshes[i].position.x -= accumulatedPos / 2 / WORLD_SCALE; } bodyMesh.isVisible = false;