From 2babfa5c1c7eefec6b3dc8dc8f0e8d912f20fbe9 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 28 May 2025 06:37:36 +0200 Subject: [PATCH] Add dynamic Y-position calculation for Spirit despawn --- node/server/public/app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/node/server/public/app.js b/node/server/public/app.js index b8d404b..8e4027c 100644 --- a/node/server/public/app.js +++ b/node/server/public/app.js @@ -329,6 +329,11 @@ class Spirit { update(dt) { const t = this.clock.getElapsedTime(); + const despawnSpeed = 0.8; + + // **NEU: Y-Position dynamisch berechnen!** + this.grp.position.y = this.spawnY - despawnSpeed * t; + // Fading if (this.spiritMeshes && this.isFading) { for (const mesh of this.spiritMeshes) { @@ -351,12 +356,8 @@ class Spirit { } } } - // Vertikales Despawn-Movement - this.grp.position.y -= 0.8 * dt; - // Nach Lebenszeit entfernen if (t > this.lifeTime) { this.dispose(); - return false; } return true; }