Explorar o código

Merge pull request #5232 from TrevorDev/alsoCorrectStartSize

Also correct start size
David Catuhe %!s(int64=7) %!d(string=hai) anos
pai
achega
2007a9d31f
Modificáronse 2 ficheiros con 12 adicións e 12 borrados
  1. 1 1
      dist/preview release/what's new.md
  2. 11 11
      src/Particles/babylon.particleSystem.ts

+ 1 - 1
dist/preview release/what's new.md

@@ -201,7 +201,7 @@
 - trackPosition:false not working in webVRCamera/controllers ([TrevorDev](https://github.com/TrevorDev))
 - Spring Joint could not be removed ([TrevorDev](https://github.com/TrevorDev))
 - Sometimes duplicate controller models are loaded in VR ([TrevorDev](https://github.com/TrevorDev))
-- Particle emit rate over time does not reset on every particle system start ([TrevorDev](https://github.com/TrevorDev))
+- Particle emit rate and start size over time do not reset on every particle system start ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 

+ 11 - 11
src/Particles/babylon.particleSystem.ts

@@ -682,17 +682,6 @@
             }
 
             this._addFactorGradient(this._startSizeGradients, gradient, factor, factor2);
-
-            if (!this._currentStartSizeGradient) {
-                this._currentStartSizeGradient = this._startSizeGradients[0];
-                this._currentStartSize1 = this._currentStartSizeGradient.getFactor();
-                this._currentStartSize2 = this._currentStartSize1;
-            }
-
-            if (this._startSizeGradients.length === 2) {
-                this._currentStartSize2 = this._startSizeGradients[1].getFactor();
-            }
-
             return this;
         }
 
@@ -1035,6 +1024,17 @@
                     this._currentEmitRate2 = this._emitRateGradients[1].getFactor();
                 }
             }
+            // Reset start size gradient so it acts the same on every start
+            if(this._startSizeGradients){
+                if(this._startSizeGradients.length > 0){
+                    this._currentStartSizeGradient = this._startSizeGradients[0];
+                    this._currentStartSize1 = this._currentStartSizeGradient.getFactor();
+                    this._currentStartSize2 = this._currentStartSize1;
+                }
+                if(this._startSizeGradients.length > 1){
+                    this._currentStartSize2 = this._startSizeGradients[1].getFactor();
+                }
+            }
 
             if (this.preWarmCycles) {
                 if (this.emitter instanceof AbstractMesh) {