From e5e6312f0d46b461b37fceb02dae9dede5dc8945 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Mon, 17 Nov 2025 23:00:35 +0100 Subject: [PATCH] Fix: Picture frame position, camera tweaks --- tv-player/src/core/animate.js | 4 ++-- tv-player/src/scene/PictureFrame.js | 3 ++- tv-player/src/scene/root.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tv-player/src/core/animate.js b/tv-player/src/core/animate.js index 46bb393..60759ba 100644 --- a/tv-player/src/core/animate.js +++ b/tv-player/src/core/animate.js @@ -14,7 +14,7 @@ function updateCamera() { // Base Camera Position in front of the TV const baseX = -0.5; const baseY = 1.5; - const baseZ = 2.5; + const baseZ = 2.2; // Base LookAt target (Center of the screen) const baseTargetX = -0.7; @@ -31,7 +31,7 @@ function updateCamera() { state.camera.position.z = baseZ + camOffsetZ; // LookAt Target Offsets (Subtle Gaze Shift) - const lookOffsetX = Math.sin(lookAtTime * 1.5) * lookAmplitude; + const lookOffsetX = Math.sin(lookAtTime * 1.5) * lookAmplitude * 3; const lookOffsetY = Math.cos(lookAtTime * 1.2) * lookAmplitude; // Apply lookAt to the subtly shifted target diff --git a/tv-player/src/scene/PictureFrame.js b/tv-player/src/scene/PictureFrame.js index eb9ce68..92274f9 100644 --- a/tv-player/src/scene/PictureFrame.js +++ b/tv-player/src/scene/PictureFrame.js @@ -61,11 +61,12 @@ export class PictureFrame { // Create two picture planes for cross-fading this.pictureBack = new THREE.Mesh(pictureGeometry, new THREE.MeshPhongMaterial({ map: this.textures[this.currentTextureIndex] })); + this.pictureBack.position.z = 0.001; this.pictureBack.receiveShadow = true; paintingGroup.add(this.pictureBack); this.pictureFront = new THREE.Mesh(pictureGeometry, new THREE.MeshPhongMaterial({ map: this.textures[this.currentTextureIndex], transparent: true, opacity: 0 })); - this.pictureFront.position.z = 0.001; // Place slightly in front to avoid z-fighting + this.pictureFront.position.z = 0.003; // Place slightly in front to avoid z-fighting this.pictureFront.receiveShadow = true; paintingGroup.add(this.pictureFront); diff --git a/tv-player/src/scene/root.js b/tv-player/src/scene/root.js index bc62e1d..483799b 100644 --- a/tv-player/src/scene/root.js +++ b/tv-player/src/scene/root.js @@ -139,7 +139,7 @@ export function createSceneObjects() { 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 + 0.1, 2.0, -state.roomSize/2 + 1.5), + position: new THREE.Vector3(-state.roomSize/2, 2.0, -state.roomSize/2 + 1.5), width: 1.5, height: 1, imageUrls: [painting1, painting2], @@ -148,7 +148,7 @@ export function createSceneObjects() { state.pictureFrames.push(pictureFrame); const pictureFrame2 = new PictureFrame(state.scene, { - position: new THREE.Vector3(state.roomSize/2 - 0.1, 2.0, 0.5), + position: new THREE.Vector3(state.roomSize/2, 2.0, 0.3), width: 1.5, height: 1, imageUrls: [painting2, painting1],