Skip to content

Commit 102aa44

Browse files
ellthompsonElliott Thompson
andauthored
[FIX] Particle world bounds CPU fix (playcanvas#2059)
Co-authored-by: Elliott Thompson <elliott@moo.com>
1 parent 0690d6d commit 102aa44

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/scene/particle-system/particle-emitter.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -384,16 +384,19 @@ Object.assign(pc, function () {
384384
this.prevWorldBoundsSize.copy(this.worldBoundsSize);
385385
this.prevWorldBoundsCenter.copy(this.worldBounds.center);
386386

387-
var recalculateLocalBounds = false;
388-
if (this.emitterShape === pc.EMITTERSHAPE_BOX) {
389-
recalculateLocalBounds = !this.emitterExtents.equals(this.prevEmitterExtents);
390-
} else {
391-
recalculateLocalBounds = !(this.emitterRadius === this.prevEmitterRadius);
392-
}
393-
if (recalculateLocalBounds) {
394-
this.calculateLocalBounds();
387+
if (!this.useCpu) {
388+
var recalculateLocalBounds = false;
389+
if (this.emitterShape === pc.EMITTERSHAPE_BOX) {
390+
recalculateLocalBounds = !this.emitterExtents.equals(this.prevEmitterExtents);
391+
} else {
392+
recalculateLocalBounds = !(this.emitterRadius === this.prevEmitterRadius);
393+
}
394+
if (recalculateLocalBounds) {
395+
this.calculateLocalBounds();
396+
}
395397
}
396398

399+
397400
var nodeWT = this.node.getWorldTransform();
398401
if (this.localSpace) {
399402
this.worldBoundsNoTrail.copy(this.localBounds);
@@ -1088,9 +1091,7 @@ Object.assign(pc, function () {
10881091

10891092
this.simTimeTotal += delta;
10901093

1091-
if (!this.useCpu) {
1092-
this.calculateWorldBounds();
1093-
}
1094+
this.calculateWorldBounds();
10941095

10951096
if (this._isAnimated()) {
10961097
var tilesParams = this.animTilesParams;

0 commit comments

Comments
 (0)