Fix: rats not visible
This commit is contained in:
parent
43e746a5a0
commit
ae3383986a
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user