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
+4 -17
View File
@@ -1,10 +1,10 @@
import * as THREE from 'three';
import { updateDoor } from '../scene/door.js';
import { updateVcrDisplay } from '../scene/vcr-display.js';
import { state } from '../state.js';
import { updateScreenEffect } from '../scene/magic-mirror.js'
import { updateCauldron } from '../scene/cauldron.js';
import { updateFire } from '../scene/fireplace.js';
import { updateRats } from '../scene/rat.js';
function updateCamera() {
const globalTime = Date.now() * 0.00003;
@@ -20,7 +20,7 @@ function updateCamera() {
// Base LookAt target (Center of the screen)
const baseTargetX = -0.2;
const baseTargetY = 1.7;
const baseTargetY = 1.6;
const baseTargetZ = -0.3;
// Camera Position Offsets (Drift)
@@ -80,18 +80,6 @@ function updateVideo() {
}
}
function updateVcr() {
const currentTime = state.baseTime + state.videoElement.currentTime;
if (Math.abs(currentTime - state.lastUpdateTime) > 0.1) {
updateVcrDisplay(currentTime);
state.lastUpdateTime = currentTime;
}
if (currentTime - state.lastBlinkToggleTime > 0.5) { // Blink every 0.5 seconds
state.blinkState = !state.blinkState;
state.lastBlinkToggleTime = currentTime;
}
}
function updateBooks() {
const LEVITATE_CHANCE = 0.0003; // Chance for a resting book to start levitating per frame
const LEVITATE_DURATION_MIN = 100; // frames
@@ -167,13 +155,12 @@ export function animate() {
updateScreenLight();
updateVideo();
updateShaderTime();
// updateVcr();
updateBooks();
// updateDoor();
// updatePictureFrame();
updatePictureFrame();
updateScreenEffect();
updateFire();
updateCauldron();
updateRats();
// RENDER!
state.renderer.render(state.scene, state.camera);