From e3e4fd5649bfd1863e3d6ffb639b0263b1975882 Mon Sep 17 00:00:00 2001 From: Daniel Belmes Date: Tue, 14 Nov 2023 14:38:32 -0800 Subject: [PATCH] Update BubbleSystem.ts --- src/systems/BubbleSystem.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/systems/BubbleSystem.ts b/src/systems/BubbleSystem.ts index d26118c..bd0c327 100644 --- a/src/systems/BubbleSystem.ts +++ b/src/systems/BubbleSystem.ts @@ -9,13 +9,14 @@ import { Vector3 } from "three"; const bubbleQuery = defineQuery([BubbleComponent]) let collectedtime = 0 //Assign out of system so scope persists -const tempvector = new Vector3(0,0,0) + export const BubbleSystem = defineSystem({ uuid: "BubbleSystem", execute: () => { const { elapsedSeconds, deltaSeconds } = getState(EngineState) for (const entity of bubbleQuery()) { + const tempvector = new Vector3(0,0,0) const bubbleComponent = getComponent(entity, BubbleComponent) const localTransform = getMutableComponent(bubbleComponent.bubbleEntity!, LocalTransformComponent) tempvector.addVectors(localTransform.position.value, bubbleComponent.direction.clone().multiplyScalar(bubbleComponent.speed))