From 09f940a5d8e10902ef285b51af0c577c5fbfc5d0 Mon Sep 17 00:00:00 2001 From: Knox Date: Wed, 20 Dec 2023 10:07:27 +0800 Subject: [PATCH] fix coefficients array not init when "updateProbes" needs to add a new probe (#16627) --- cocos/gi/light-probe/light-probe.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cocos/gi/light-probe/light-probe.ts b/cocos/gi/light-probe/light-probe.ts index 8578b10249..7248a9b8bb 100644 --- a/cocos/gi/light-probe/light-probe.ts +++ b/cocos/gi/light-probe/light-probe.ts @@ -73,6 +73,10 @@ export class LightProbesData { let probe = this._probes[i]; if (!probe) { probe = new Vertex(points[i]); + for (let j = 0; j < SH.getBasisCount(); j++) { + probe.coefficients[j] = Vec3.ZERO; + } + this._probes[i] = probe; } else { probe.position.set(points[i]); }