Fix: rats not visible

This commit is contained in:
Dejvino
2025-11-20 19:40:59 +01:00
parent 43e746a5a0
commit ae3383986a
3 changed files with 22 additions and 25 deletions
+5 -4
View File
@@ -1,7 +1,7 @@
import * as THREE from 'three';
import { state } from '../state.js';
const SLEEP_WAIT = 1;
const SLEEP_WAIT = 60;
export class Rat {
constructor(path, initialDelay) {
@@ -69,9 +69,10 @@ export function createRats(x, y, z, rotY) {
const ratPath = new THREE.CatmullRomCurve3([
new THREE.Vector3(x, y, z), // Start at the hole
new THREE.Vector3(x-2.0, 0, z),
new THREE.Vector3(0, 0, 1.0),
new THREE.Vector3(-1.0, 0, 1.8),
new THREE.Vector3(-1.5, 0, 0.5),
new THREE.Vector3(0.8, 0, -1.2),
new THREE.Vector3(-1.0, 0, -1.3),
new THREE.Vector3(-1.8, 0, -1.0),
new THREE.Vector3(-1.9, 0, 0.7),
new THREE.Vector3(0.5, 0, 0.5),
new THREE.Vector3(1.8, 0, 1.0),
new THREE.Vector3(x, y, z), // End at the hole
+13 -4
View File
@@ -78,7 +78,7 @@ export function createSceneObjects() {
state.scene.add(candleGroup);
createTable(-1.8, 0, -0.8, Math.PI / 2.3);
createTable(-1.8, 0, -1.2, Math.PI / 2.3);
// Add cauldron on top of the table (Y = table height + cauldron radius)
createCauldron(-1.8, 0.5 + 0.2, -0.8);
@@ -143,13 +143,13 @@ export function createSceneObjects() {
createRats(state.roomSize/2 - 0.01, 0, 0.37, -Math.PI / 2);
createBookshelf(-state.roomSize/2 + 0.2, state.roomSize/2*0.2, Math.PI/2, 0);
createBookshelf(-state.roomSize/2 + 0.2, state.roomSize/2*0.1, Math.PI/2, 0);
createBookshelf(-state.roomSize/2 + 0.2, state.roomSize/2*0.7, Math.PI/2, 0);
createBookshelf(-state.roomSize/2 * 0.7, -state.roomSize/2+0.3, 0, 1);
const pictureFrame = new PictureFrame(state.scene, {
position: new THREE.Vector3(-state.roomSize/2, 1.7, -state.roomSize/2 + 0.6),
width: 0.5,
position: new THREE.Vector3(-state.roomSize/2, 1.7, -state.roomSize/2 + 0.7),
width: 0.7,
height: 1,
imageUrls: [painting1, painting2],
rotationY: Math.PI / 2
@@ -165,4 +165,13 @@ export function createSceneObjects() {
rotationY: -Math.PI / 2
});
state.pictureFrames.push(pictureFrame2);
const pictureFrame3 = new PictureFrame(state.scene, {
position: new THREE.Vector3(state.roomSize/2, 1.7, 0.75),
width: 0.7,
height: 1.2,
imageUrls: [painting2, painting1],
rotationY: -Math.PI / 2
});
state.pictureFrames.push(pictureFrame3);
}