Skip to content

Commit

Permalink
Add support for manualEmitCount for GPUParticles (#16108)
Browse files Browse the repository at this point in the history
Co-authored-by: David Catuhe <[email protected]>
  • Loading branch information
deltakosh and David Catuhe authored Jan 24, 2025
1 parent 7fa12bb commit 907ae27
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/dev/core/src/Particles/gpuParticleSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,13 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable
// Get everything ready to render
this._initialize();

this._accumulatedCount += this.emitRate * this._timeDelta;
if (this._accumulatedCount > 1) {
if (this.manualEmitCount > -1) {
this._accumulatedCount += this.manualEmitCount;
this.manualEmitCount = 0;
} else {
this._accumulatedCount += this.emitRate * this._timeDelta;
}
if (this._accumulatedCount >= 1) {
const intPart = this._accumulatedCount | 0;
this._accumulatedCount -= intPart;
this._currentActiveCount += intPart;
Expand Down

0 comments on commit 907ae27

Please sign in to comment.