Add dynamic Y-position calculation for Spirit despawn
This commit is contained in:
@@ -329,6 +329,11 @@ class Spirit {
|
|||||||
|
|
||||||
update(dt) {
|
update(dt) {
|
||||||
const t = this.clock.getElapsedTime();
|
const t = this.clock.getElapsedTime();
|
||||||
|
const despawnSpeed = 0.8;
|
||||||
|
|
||||||
|
// **NEU: Y-Position dynamisch berechnen!**
|
||||||
|
this.grp.position.y = this.spawnY - despawnSpeed * t;
|
||||||
|
|
||||||
// Fading
|
// Fading
|
||||||
if (this.spiritMeshes && this.isFading) {
|
if (this.spiritMeshes && this.isFading) {
|
||||||
for (const mesh of this.spiritMeshes) {
|
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) {
|
if (t > this.lifeTime) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user