瀏覽代碼

Fix subEmitters random origin value

David Catuhe 7 年之前
父節點
當前提交
f002185bfe

文件差異過大導致無法顯示
+ 9361 - 9358
Playground/babylon.d.txt


文件差異過大導致無法顯示
+ 9380 - 9377
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.js


+ 33 - 24
dist/preview release/babylon.max.js

@@ -55799,6 +55799,35 @@ var BABYLON;
             this.cellIndex = this._initialStartSpriteCellID + (ratio * dist) | 0;
         };
         /** @hidden */
+        Particle.prototype._inheritParticleInfoToSubEmitter = function (subEmitter) {
+            if (subEmitter.particleSystem.emitter.position) {
+                var emitterMesh = subEmitter.particleSystem.emitter;
+                emitterMesh.position.copyFrom(this.position);
+                if (subEmitter.inheritDirection) {
+                    emitterMesh.position.subtractToRef(this.direction, BABYLON.Tmp.Vector3[0]);
+                    // Look at using Y as forward
+                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
+                }
+                emitterMesh.computeWorldMatrix(true);
+            }
+            else {
+                var emitterPosition = subEmitter.particleSystem.emitter;
+                emitterPosition.copyFrom(this.position);
+            }
+            // Set inheritedVelocityOffset to be used when new particles are created
+            this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
+            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
+        };
+        /** @hidden */
+        Particle.prototype._inheritParticleInfoToSubEmitters = function () {
+            var _this = this;
+            if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {
+                this._attachedSubEmitters.forEach(function (subEmitter) {
+                    _this, _this._inheritParticleInfoToSubEmitter(subEmitter);
+                });
+            }
+        };
+        /** @hidden */
         Particle.prototype._reset = function () {
             this.age = 0;
             this._currentColorGradient = null;
@@ -56629,7 +56658,7 @@ var BABYLON;
                 _this._subEmitters[templateIndex].forEach(function (subEmitter) {
                     if (subEmitter.type === BABYLON.SubEmitterType.END) {
                         var subSystem = subEmitter.clone();
-                        ParticleSystem._InheritParticleInfoToSubEmitter(subSystem, particle);
+                        particle._inheritParticleInfoToSubEmitter(subSystem);
                         subSystem.particleSystem._rootParticleSystem = _this;
                         _this.activeSubSystems.push(subSystem.particleSystem);
                         subSystem.particleSystem.start();
@@ -56795,11 +56824,7 @@ var BABYLON;
                             particle.updateCellIndex();
                         }
                         // Update the position of the attached sub-emitters to match their attached particle
-                        if (particle._attachedSubEmitters && particle._attachedSubEmitters.length > 0) {
-                            particle._attachedSubEmitters.forEach(function (subEmitter) {
-                                ParticleSystem._InheritParticleInfoToSubEmitter(subEmitter, particle);
-                            });
-                        }
+                        particle._inheritParticleInfoToSubEmitters();
                     }
                 };
                 var particle;
@@ -56857,24 +56882,6 @@ var BABYLON;
         ParticleSystem.prototype.getClassName = function () {
             return "ParticleSystem";
         };
-        ParticleSystem._InheritParticleInfoToSubEmitter = function (subEmitter, particle) {
-            if (subEmitter.particleSystem.emitter.position) {
-                var emitterMesh = subEmitter.particleSystem.emitter;
-                emitterMesh.position.copyFrom(particle.position);
-                if (subEmitter.inheritDirection) {
-                    emitterMesh.position.subtractToRef(particle.direction, BABYLON.Tmp.Vector3[0]);
-                    // Look at using Y as forward
-                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
-                }
-            }
-            else {
-                var emitterPosition = subEmitter.particleSystem.emitter;
-                emitterPosition.copyFrom(particle.position);
-            }
-            // Set inheritedVelocityOffset to be used when new particles are created
-            particle.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
-            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
-        };
         ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {
             var newGradient = new BABYLON.FactorGradient();
             newGradient.gradient = gradient;
@@ -57710,6 +57717,8 @@ var BABYLON;
                         particle._randomNoiseCoordinates2 = new BABYLON.Vector3(Math.random(), Math.random(), Math.random());
                     }
                 }
+                // Update the position of the attached sub-emitters to match their attached particle
+                particle._inheritParticleInfoToSubEmitters();
             };
             var this_1 = this, step;
             for (var index = 0; index < newParticles; index++) {

+ 33 - 24
dist/preview release/babylon.no-module.max.js

@@ -55766,6 +55766,35 @@ var BABYLON;
             this.cellIndex = this._initialStartSpriteCellID + (ratio * dist) | 0;
         };
         /** @hidden */
+        Particle.prototype._inheritParticleInfoToSubEmitter = function (subEmitter) {
+            if (subEmitter.particleSystem.emitter.position) {
+                var emitterMesh = subEmitter.particleSystem.emitter;
+                emitterMesh.position.copyFrom(this.position);
+                if (subEmitter.inheritDirection) {
+                    emitterMesh.position.subtractToRef(this.direction, BABYLON.Tmp.Vector3[0]);
+                    // Look at using Y as forward
+                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
+                }
+                emitterMesh.computeWorldMatrix(true);
+            }
+            else {
+                var emitterPosition = subEmitter.particleSystem.emitter;
+                emitterPosition.copyFrom(this.position);
+            }
+            // Set inheritedVelocityOffset to be used when new particles are created
+            this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
+            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
+        };
+        /** @hidden */
+        Particle.prototype._inheritParticleInfoToSubEmitters = function () {
+            var _this = this;
+            if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {
+                this._attachedSubEmitters.forEach(function (subEmitter) {
+                    _this, _this._inheritParticleInfoToSubEmitter(subEmitter);
+                });
+            }
+        };
+        /** @hidden */
         Particle.prototype._reset = function () {
             this.age = 0;
             this._currentColorGradient = null;
@@ -56596,7 +56625,7 @@ var BABYLON;
                 _this._subEmitters[templateIndex].forEach(function (subEmitter) {
                     if (subEmitter.type === BABYLON.SubEmitterType.END) {
                         var subSystem = subEmitter.clone();
-                        ParticleSystem._InheritParticleInfoToSubEmitter(subSystem, particle);
+                        particle._inheritParticleInfoToSubEmitter(subSystem);
                         subSystem.particleSystem._rootParticleSystem = _this;
                         _this.activeSubSystems.push(subSystem.particleSystem);
                         subSystem.particleSystem.start();
@@ -56762,11 +56791,7 @@ var BABYLON;
                             particle.updateCellIndex();
                         }
                         // Update the position of the attached sub-emitters to match their attached particle
-                        if (particle._attachedSubEmitters && particle._attachedSubEmitters.length > 0) {
-                            particle._attachedSubEmitters.forEach(function (subEmitter) {
-                                ParticleSystem._InheritParticleInfoToSubEmitter(subEmitter, particle);
-                            });
-                        }
+                        particle._inheritParticleInfoToSubEmitters();
                     }
                 };
                 var particle;
@@ -56824,24 +56849,6 @@ var BABYLON;
         ParticleSystem.prototype.getClassName = function () {
             return "ParticleSystem";
         };
-        ParticleSystem._InheritParticleInfoToSubEmitter = function (subEmitter, particle) {
-            if (subEmitter.particleSystem.emitter.position) {
-                var emitterMesh = subEmitter.particleSystem.emitter;
-                emitterMesh.position.copyFrom(particle.position);
-                if (subEmitter.inheritDirection) {
-                    emitterMesh.position.subtractToRef(particle.direction, BABYLON.Tmp.Vector3[0]);
-                    // Look at using Y as forward
-                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
-                }
-            }
-            else {
-                var emitterPosition = subEmitter.particleSystem.emitter;
-                emitterPosition.copyFrom(particle.position);
-            }
-            // Set inheritedVelocityOffset to be used when new particles are created
-            particle.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
-            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
-        };
         ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {
             var newGradient = new BABYLON.FactorGradient();
             newGradient.gradient = gradient;
@@ -57677,6 +57684,8 @@ var BABYLON;
                         particle._randomNoiseCoordinates2 = new BABYLON.Vector3(Math.random(), Math.random(), Math.random());
                     }
                 }
+                // Update the position of the attached sub-emitters to match their attached particle
+                particle._inheritParticleInfoToSubEmitters();
             };
             var this_1 = this, step;
             for (var index = 0; index < newParticles; index++) {

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.worker.js


+ 33 - 24
dist/preview release/es6.js

@@ -55766,6 +55766,35 @@ var BABYLON;
             this.cellIndex = this._initialStartSpriteCellID + (ratio * dist) | 0;
         };
         /** @hidden */
+        Particle.prototype._inheritParticleInfoToSubEmitter = function (subEmitter) {
+            if (subEmitter.particleSystem.emitter.position) {
+                var emitterMesh = subEmitter.particleSystem.emitter;
+                emitterMesh.position.copyFrom(this.position);
+                if (subEmitter.inheritDirection) {
+                    emitterMesh.position.subtractToRef(this.direction, BABYLON.Tmp.Vector3[0]);
+                    // Look at using Y as forward
+                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
+                }
+                emitterMesh.computeWorldMatrix(true);
+            }
+            else {
+                var emitterPosition = subEmitter.particleSystem.emitter;
+                emitterPosition.copyFrom(this.position);
+            }
+            // Set inheritedVelocityOffset to be used when new particles are created
+            this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
+            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
+        };
+        /** @hidden */
+        Particle.prototype._inheritParticleInfoToSubEmitters = function () {
+            var _this = this;
+            if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {
+                this._attachedSubEmitters.forEach(function (subEmitter) {
+                    _this, _this._inheritParticleInfoToSubEmitter(subEmitter);
+                });
+            }
+        };
+        /** @hidden */
         Particle.prototype._reset = function () {
             this.age = 0;
             this._currentColorGradient = null;
@@ -56596,7 +56625,7 @@ var BABYLON;
                 _this._subEmitters[templateIndex].forEach(function (subEmitter) {
                     if (subEmitter.type === BABYLON.SubEmitterType.END) {
                         var subSystem = subEmitter.clone();
-                        ParticleSystem._InheritParticleInfoToSubEmitter(subSystem, particle);
+                        particle._inheritParticleInfoToSubEmitter(subSystem);
                         subSystem.particleSystem._rootParticleSystem = _this;
                         _this.activeSubSystems.push(subSystem.particleSystem);
                         subSystem.particleSystem.start();
@@ -56762,11 +56791,7 @@ var BABYLON;
                             particle.updateCellIndex();
                         }
                         // Update the position of the attached sub-emitters to match their attached particle
-                        if (particle._attachedSubEmitters && particle._attachedSubEmitters.length > 0) {
-                            particle._attachedSubEmitters.forEach(function (subEmitter) {
-                                ParticleSystem._InheritParticleInfoToSubEmitter(subEmitter, particle);
-                            });
-                        }
+                        particle._inheritParticleInfoToSubEmitters();
                     }
                 };
                 var particle;
@@ -56824,24 +56849,6 @@ var BABYLON;
         ParticleSystem.prototype.getClassName = function () {
             return "ParticleSystem";
         };
-        ParticleSystem._InheritParticleInfoToSubEmitter = function (subEmitter, particle) {
-            if (subEmitter.particleSystem.emitter.position) {
-                var emitterMesh = subEmitter.particleSystem.emitter;
-                emitterMesh.position.copyFrom(particle.position);
-                if (subEmitter.inheritDirection) {
-                    emitterMesh.position.subtractToRef(particle.direction, BABYLON.Tmp.Vector3[0]);
-                    // Look at using Y as forward
-                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
-                }
-            }
-            else {
-                var emitterPosition = subEmitter.particleSystem.emitter;
-                emitterPosition.copyFrom(particle.position);
-            }
-            // Set inheritedVelocityOffset to be used when new particles are created
-            particle.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
-            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
-        };
         ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {
             var newGradient = new BABYLON.FactorGradient();
             newGradient.gradient = gradient;
@@ -57677,6 +57684,8 @@ var BABYLON;
                         particle._randomNoiseCoordinates2 = new BABYLON.Vector3(Math.random(), Math.random(), Math.random());
                     }
                 }
+                // Update the position of the attached sub-emitters to match their attached particle
+                particle._inheritParticleInfoToSubEmitters();
             };
             var this_1 = this, step;
             for (var index = 0; index < newParticles; index++) {

+ 2 - 159
dist/preview release/viewer/babylon.viewer.d.ts

@@ -515,167 +515,10 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * The current state of the model
-        */
-    export enum ModelState {
-            INIT = 0,
-            LOADING = 1,
-            LOADED = 2,
-            ENTRY = 3,
-            ENTRYDONE = 4,
-            COMPLETE = 5,
-            CANCELED = 6,
-            ERROR = 7
-    }
-    /**
-        * The viewer model is a container for all assets representing a sngle loaded model.
-        */
-    export class ViewerModel implements BABYLON.IDisposable {
-            /**
-                * The loader used to load this model.
-                */
-            loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
-            /**
-                * This model's root mesh (the parent of all other meshes).
-                * This mesh does not(!) exist in the meshes array.
-                */
-            rootMesh: BABYLON.AbstractMesh;
-            /**
-                * ParticleSystems connected to this model
-                */
-            particleSystems: Array<BABYLON.IParticleSystem>;
-            /**
-                * Skeletons defined in this model
-                */
-            skeletons: Array<BABYLON.Skeleton>;
-            /**
-                * The current model animation.
-                * On init, this will be undefined.
-                */
-            currentAnimation: IModelAnimation;
-            /**
-                * Observers registered here will be executed when the model is done loading
-                */
-            onLoadedObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed when the loader notified of a progress event
-                */
-            onLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
-            /**
-                * Observers registered here will be executed when the loader notified of an error.
-                */
-            onLoadErrorObservable: BABYLON.Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will be executed after the model finished loading and complete, including entry animation and lod
-                */
-            onCompleteObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed every time the model is being configured.
-                * This can be used to extend the model's configuration without extending the class itself
-                */
-            onAfterConfigure: BABYLON.Observable<ViewerModel>;
-            /**
-                * The current model state (loaded, error, etc)
-                */
-            state: ModelState;
-            /**
-                * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
-                */
-            loadId: number;
-            loadInfo: BABYLON.GLTF2.IAsset;
-            constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
-            shadowsRenderedAfterLoad: boolean;
-            getViewerId(): string | undefined;
-            /**
-             * Set whether this model is enabled or not.
-             */
-            enabled: boolean;
-            loaderDone: boolean;
-            /**
-                * Add a mesh to this model.
-                * Any mesh that has no parent will be provided with the root mesh as its new parent.
-                *
-                * @param mesh the new mesh to add
-                * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
-                */
-            addMesh(mesh: BABYLON.AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
-            /**
-                * get the list of meshes (excluding the root mesh)
-                */
-            readonly meshes: BABYLON.AbstractMesh[];
-            /**
-             * (Re-)set the model's entire configuration
-             * @param newConfiguration the new configuration to replace the new one
-             */
-            configuration: IModelConfiguration;
-            /**
-                * Update the current configuration with new values.
-                * Configuration will not be overwritten, but merged with the new configuration.
-                * Priority is to the new configuration
-                * @param newConfiguration the configuration to be merged into the current configuration;
-                */
-            updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
-            /**
-                * Add a new animation group to this model.
-                * @param animationGroup the new animation group to be added
-                */
-            addAnimationGroup(animationGroup: BABYLON.AnimationGroup): void;
-            /**
-                * Get the ModelAnimation array
-                */
-            getAnimations(): Array<IModelAnimation>;
-            /**
-                * Get the animations' names. Using the names you can play a specific animation.
-                */
-            getAnimationNames(): Array<string>;
-            /**
-                * Get an animation by the provided name. Used mainly when playing n animation.
-                * @param name the name of the animation to find
-                */
-            protected _getAnimationByName(name: string): BABYLON.Nullable<IModelAnimation>;
-            /**
-                * Choose an initialized animation using its name and start playing it
-                * @param name the name of the animation to play
-                * @returns The model aniamtion to be played.
-                */
-            playAnimation(name: string): IModelAnimation;
-            setCurrentAnimationByName(name: string): IModelAnimation;
-            /**
-                * Apply a material configuration to a material
-                * @param material BABYLON.Material to apply configuration to
-                * @hidden
-                */
-            _applyModelMaterialConfiguration(material: BABYLON.Material): void;
-            /**
-             * Begin @animations with the specified @easingFunction
-             * @param animations The BABYLON Animations to begin
-             * @param duration of transition, in seconds
-             * @param easingFunction An easing function to apply
-             * @param easingMode A easing mode to apply to the easingFunction
-             * @param onAnimationEnd Call back trigger at the end of the animation.
-             */
-            transitionTo(animations: BABYLON.Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
-            /**
-                * Stops and removes all animations that have been applied to the model
-                */
-            stopAllAnimations(): void;
-            /**
-                * Will remove this model from the viewer (but NOT dispose it).
-                */
-            remove(): void;
-            /**
-                * Dispose this model, including all of its associated assets.
-                */
-            dispose(): void;
-    }
 }
 declare module BabylonViewer {
     /**
-        * BABYLON.Animation play mode enum - is the animation looping or playing once
+        * Animation play mode enum - is the animation looping or playing once
         */
     export const enum AnimationPlayMode {
             ONCE = 0,
@@ -757,7 +600,7 @@ declare module BabylonViewer {
                 */
             readonly currentFrame: number;
             /**
-                * BABYLON.Animation's FPS value
+                * Animation's FPS value
                 */
             readonly fps: number;
             /**

文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 163
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -566,169 +566,7 @@ declare module 'babylonjs-viewer/loader/modelLoader' {
 }
 
 declare module 'babylonjs-viewer/model/viewerModel' {
-    import { ISceneLoaderPlugin, ISceneLoaderPluginAsync, AnimationGroup, AbstractMesh, Observable, SceneLoaderProgressEvent, IParticleSystem, Skeleton, IDisposable, Nullable, Animation, Material } from "babylonjs";
-    import { GLTF2 } from "babylonjs-loaders";
-    import { IModelConfiguration } from "babylonjs-viewer/configuration/interfaces/modelConfiguration";
-    import { IModelAnimation } from "babylonjs-viewer/model/modelAnimation";
-    import { ObservablesManager } from "babylonjs-viewer/managers/observablesManager";
-    import { ConfigurationContainer } from "babylonjs-viewer/configuration/configurationContainer";
-    /**
-        * The current state of the model
-        */
-    export enum ModelState {
-            INIT = 0,
-            LOADING = 1,
-            LOADED = 2,
-            ENTRY = 3,
-            ENTRYDONE = 4,
-            COMPLETE = 5,
-            CANCELED = 6,
-            ERROR = 7
-    }
-    /**
-        * The viewer model is a container for all assets representing a sngle loaded model.
-        */
-    export class ViewerModel implements IDisposable {
-            /**
-                * The loader used to load this model.
-                */
-            loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-            /**
-                * This model's root mesh (the parent of all other meshes).
-                * This mesh does not(!) exist in the meshes array.
-                */
-            rootMesh: AbstractMesh;
-            /**
-                * ParticleSystems connected to this model
-                */
-            particleSystems: Array<IParticleSystem>;
-            /**
-                * Skeletons defined in this model
-                */
-            skeletons: Array<Skeleton>;
-            /**
-                * The current model animation.
-                * On init, this will be undefined.
-                */
-            currentAnimation: IModelAnimation;
-            /**
-                * Observers registered here will be executed when the model is done loading
-                */
-            onLoadedObservable: Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed when the loader notified of a progress event
-                */
-            onLoadProgressObservable: Observable<SceneLoaderProgressEvent>;
-            /**
-                * Observers registered here will be executed when the loader notified of an error.
-                */
-            onLoadErrorObservable: Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will be executed after the model finished loading and complete, including entry animation and lod
-                */
-            onCompleteObservable: Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed every time the model is being configured.
-                * This can be used to extend the model's configuration without extending the class itself
-                */
-            onAfterConfigure: Observable<ViewerModel>;
-            /**
-                * The current model state (loaded, error, etc)
-                */
-            state: ModelState;
-            /**
-                * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
-                */
-            loadId: number;
-            loadInfo: GLTF2.IAsset;
-            constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
-            shadowsRenderedAfterLoad: boolean;
-            getViewerId(): string | undefined;
-            /**
-             * Set whether this model is enabled or not.
-             */
-            enabled: boolean;
-            loaderDone: boolean;
-            /**
-                * Add a mesh to this model.
-                * Any mesh that has no parent will be provided with the root mesh as its new parent.
-                *
-                * @param mesh the new mesh to add
-                * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
-                */
-            addMesh(mesh: AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
-            /**
-                * get the list of meshes (excluding the root mesh)
-                */
-            readonly meshes: AbstractMesh[];
-            /**
-             * (Re-)set the model's entire configuration
-             * @param newConfiguration the new configuration to replace the new one
-             */
-            configuration: IModelConfiguration;
-            /**
-                * Update the current configuration with new values.
-                * Configuration will not be overwritten, but merged with the new configuration.
-                * Priority is to the new configuration
-                * @param newConfiguration the configuration to be merged into the current configuration;
-                */
-            updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
-            /**
-                * Add a new animation group to this model.
-                * @param animationGroup the new animation group to be added
-                */
-            addAnimationGroup(animationGroup: AnimationGroup): void;
-            /**
-                * Get the ModelAnimation array
-                */
-            getAnimations(): Array<IModelAnimation>;
-            /**
-                * Get the animations' names. Using the names you can play a specific animation.
-                */
-            getAnimationNames(): Array<string>;
-            /**
-                * Get an animation by the provided name. Used mainly when playing n animation.
-                * @param name the name of the animation to find
-                */
-            protected _getAnimationByName(name: string): Nullable<IModelAnimation>;
-            /**
-                * Choose an initialized animation using its name and start playing it
-                * @param name the name of the animation to play
-                * @returns The model aniamtion to be played.
-                */
-            playAnimation(name: string): IModelAnimation;
-            setCurrentAnimationByName(name: string): IModelAnimation;
-            /**
-                * Apply a material configuration to a material
-                * @param material Material to apply configuration to
-                * @hidden
-                */
-            _applyModelMaterialConfiguration(material: Material): void;
-            /**
-             * Begin @animations with the specified @easingFunction
-             * @param animations The BABYLON Animations to begin
-             * @param duration of transition, in seconds
-             * @param easingFunction An easing function to apply
-             * @param easingMode A easing mode to apply to the easingFunction
-             * @param onAnimationEnd Call back trigger at the end of the animation.
-             */
-            transitionTo(animations: Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
-            /**
-                * Stops and removes all animations that have been applied to the model
-                */
-            stopAllAnimations(): void;
-            /**
-                * Will remove this model from the viewer (but NOT dispose it).
-                */
-            remove(): void;
-            /**
-                * Dispose this model, including all of its associated assets.
-                */
-            dispose(): void;
-    }
+    
 }
 
 declare module 'babylonjs-viewer/model/modelAnimation' {

+ 28 - 0
src/Particles/babylon.particle.ts

@@ -179,6 +179,34 @@
         }
 
         /** @hidden */
+        public _inheritParticleInfoToSubEmitter(subEmitter: SubEmitter) {
+            if ((<AbstractMesh>subEmitter.particleSystem.emitter).position) {
+                var emitterMesh = (<AbstractMesh>subEmitter.particleSystem.emitter);
+                emitterMesh.position.copyFrom(this.position);
+                if (subEmitter.inheritDirection) { 
+                    emitterMesh.position.subtractToRef(this.direction, BABYLON.Tmp.Vector3[0]);
+                    // Look at using Y as forward
+                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
+                }
+            } else {
+                var emitterPosition = (<Vector3>subEmitter.particleSystem.emitter);
+                emitterPosition.copyFrom(this.position);
+            }
+            // Set inheritedVelocityOffset to be used when new particles are created
+            this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, Tmp.Vector3[0]);
+            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(Tmp.Vector3[0]);
+        }
+
+        /** @hidden */
+        public _inheritParticleInfoToSubEmitters() {
+            if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {
+                this._attachedSubEmitters.forEach((subEmitter) => {
+                    this._inheritParticleInfoToSubEmitter(subEmitter);
+                });
+            }
+        }
+
+        /** @hidden */
         public _reset() {
             this.age = 0;
             this._currentColorGradient = null;

+ 5 - 24
src/Particles/babylon.particleSystem.ts

@@ -353,34 +353,12 @@
                         }
 
                         // Update the position of the attached sub-emitters to match their attached particle
-                        if (particle._attachedSubEmitters && particle._attachedSubEmitters.length > 0) {
-                            particle._attachedSubEmitters.forEach((subEmitter) => {
-                                ParticleSystem._InheritParticleInfoToSubEmitter(subEmitter, particle);
-                            });
-                        }
+                        particle._inheritParticleInfoToSubEmitters();
                     }
                 }
             }
         }
 
-        private static _InheritParticleInfoToSubEmitter(subEmitter: SubEmitter, particle: Particle) {
-            if ((<AbstractMesh>subEmitter.particleSystem.emitter).position) {
-                var emitterMesh = (<AbstractMesh>subEmitter.particleSystem.emitter);
-                emitterMesh.position.copyFrom(particle.position);
-                if (subEmitter.inheritDirection) {
-                    emitterMesh.position.subtractToRef(particle.direction, BABYLON.Tmp.Vector3[0]);
-                    // Look at using Y as forward
-                    emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
-                }
-            } else {
-                var emitterPosition = (<Vector3>subEmitter.particleSystem.emitter);
-                emitterPosition.copyFrom(particle.position);
-            }
-            // Set inheritedVelocityOffset to be used when new particles are created
-            particle.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, Tmp.Vector3[0]);
-            subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(Tmp.Vector3[0]);
-        }
-
         private _addFactorGradient(factorGradients: FactorGradient[], gradient: number, factor: number, factor2?: number) {
             let newGradient = new FactorGradient();
             newGradient.gradient = gradient;
@@ -1200,7 +1178,7 @@
             this._subEmitters[templateIndex].forEach((subEmitter) => {
                 if (subEmitter.type === SubEmitterType.END) {
                     var subSystem = subEmitter.clone();
-                    ParticleSystem._InheritParticleInfoToSubEmitter(subSystem, particle);
+                    particle._inheritParticleInfoToSubEmitter(subSystem);
                     subSystem.particleSystem._rootParticleSystem = this;
                     this.activeSubSystems.push(subSystem.particleSystem);
                     subSystem.particleSystem.start();
@@ -1407,6 +1385,9 @@
                         particle._randomNoiseCoordinates2 = new Vector3(Math.random(), Math.random(), Math.random());
                     }            
                 }
+
+                // Update the position of the attached sub-emitters to match their attached particle
+                particle._inheritParticleInfoToSubEmitters();
     
             }
         }

+ 1 - 1
src/Particles/babylon.subEmitter.ts

@@ -52,7 +52,7 @@ module BABYLON {
             } else if (emitter instanceof Vector3) {
                 emitter = emitter.clone();
             } else if (emitter instanceof AbstractMesh) {
-                emitter = new Mesh("", emitter._scene);
+                emitter = new Mesh("", emitter.getScene());
             }
             var clone = new SubEmitter(this.particleSystem.clone("", emitter));