Browse Source

Merge pull request #4740 from Pryme8/patch-7

Sphere Emitter Update
David Catuhe 7 years ago
parent
commit
3d58ee9332

+ 8 - 9
src/Particles/EmitterTypes/babylon.sphereParticleEmitter.ts

@@ -4,22 +4,21 @@ module BABYLON {
      * It emits the particles alongside the sphere radius. The emission direction might be randomized.
      * It emits the particles alongside the sphere radius. The emission direction might be randomized.
      */
      */
     export class SphereParticleEmitter implements IParticleEmitterType {
     export class SphereParticleEmitter implements IParticleEmitterType {
-
-        /**
-         * Gets or sets a value indicating where on the radius the start position should be picked (1 = everywhere, 0 = only surface)
-         */
-        public radiusRange = 1;
-
-        /**
+         /**
          * Creates a new instance SphereParticleEmitter
          * Creates a new instance SphereParticleEmitter
          * @param radius the radius of the emission sphere (1 by default)
          * @param radius the radius of the emission sphere (1 by default)
+         * @param radiusRange the range of the emission sphere [0-1] 0 Surface only, 1 Entire Radius (1 by default) 
          * @param directionRandomizer defines how much to randomize the particle direction [0-1]
          * @param directionRandomizer defines how much to randomize the particle direction [0-1]
          */
          */
         constructor(
         constructor(
             /**
             /**
              * The radius of the emission sphere.
              * The radius of the emission sphere.
              */
              */
-            public radius = 1, 
+            public radius = 1,
+            /**
+             * The range of emission [0-1] 0 Surface only, 1 Entire Radius.
+             */
+            public radiusRange = 1,
             /**
             /**
              * How much to randomize the particle direction [0-1].
              * How much to randomize the particle direction [0-1].
              */
              */
@@ -224,4 +223,4 @@ module BABYLON {
             this.direction2.copyFrom(serializationObject.direction2);
             this.direction2.copyFrom(serializationObject.direction2);
         }           
         }           
     }
     }
-}
+}

+ 4 - 3
src/Particles/babylon.particleSystem.ts

@@ -1545,10 +1545,11 @@
         /**
         /**
          * Creates a Sphere Emitter for the particle system. (emits along the sphere radius)
          * Creates a Sphere Emitter for the particle system. (emits along the sphere radius)
          * @param radius The radius of the sphere to emit from
          * @param radius The radius of the sphere to emit from
+         * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
          * @returns the emitter
          * @returns the emitter
          */
          */
-        public createSphereEmitter(radius = 1): SphereParticleEmitter {
-            var particleEmitter = new SphereParticleEmitter(radius);
+        public createSphereEmitter(radius = 1, radiusRange = 1): SphereParticleEmitter {
+            var particleEmitter = new SphereParticleEmitter(radius, radiusRange);
             this.particleEmitterType = particleEmitter;
             this.particleEmitterType = particleEmitter;
             return particleEmitter;
             return particleEmitter;
         }
         }
@@ -1961,4 +1962,4 @@
             return particleSystem;
             return particleSystem;
         }
         }
     }
     }
-}
+}