Skip to content

Commit fc83c48

Browse files
committed
scaling the bed
1 parent b6d5e8d commit fc83c48

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

client/src/game-client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ export class GameClient {
174174
if (this.scene) {
175175
this.scene.add(bed);
176176
this.worldObjects.push(bed);
177+
console.log('Bed loaded successfully at position:', bed.position);
178+
console.log('Bed bounding box:', new THREE.Box3().setFromObject(bed));
179+
} else {
180+
console.error('Scene is null, cannot add bed');
177181
}
178182
})
179183
.catch((error) => {

client/src/world/WorldObjectFactory.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ export class WorldObjectFactory {
173173
(gltf) => {
174174
const bed = gltf.scene;
175175

176+
// Scale the bed to match game units (1 unit = 1 cm)
177+
// GLB models are typically in meters, so multiply by 100 to convert to cm
178+
const scaleFactor = 100;
179+
bed.scale.set(scaleFactor, scaleFactor, scaleFactor);
180+
176181
// Enable shadows on all meshes
177182
bed.traverse((child) => {
178183
if (child instanceof THREE.Mesh) {
@@ -184,10 +189,15 @@ export class WorldObjectFactory {
184189
// Position the bed
185190
bed.position.set(x, 0, z);
186191

192+
console.log('[WorldObjectFactory] Bed loaded at position:', bed.position, 'scale:', bed.scale);
193+
187194
resolve(bed);
188195
},
189-
undefined,
196+
(progress) => {
197+
console.log('[WorldObjectFactory] Loading bed progress:', progress);
198+
},
190199
(error) => {
200+
console.error('[WorldObjectFactory] Failed to load bed:', error);
191201
reject(error);
192202
}
193203
);

0 commit comments

Comments
 (0)