Class ParticleHelper
Constructors
constructor
-
Returns ParticleHelper
Properties
StaticBase Assets Url
Gets or sets base Assets URL
StaticCreate From Snippet Async
snippetId: string,
scene: Scene,
gpu?: boolean,
rootUrl?: string,
capacity?: number,
) => Promise<IParticleSystem> = ParticleHelper.ParseFromSnippetAsync
Creates a particle system from a snippet saved by the particle system editor
Type Declaration
-
- (
snippetId: string,
scene: Scene,
gpu?: boolean,
rootUrl?: string,
capacity?: number,
): Promise<IParticleSystem> -
Creates a particle system from a snippet saved by the particle system editor
Parameters
- snippetId: string
defines the snippet to load (can be set to _BLANK to create a default one)
- scene: Scene
defines the hosting scene
- gpu: boolean = false
If the system will use gpu
- rootUrl: string = ""
defines the root URL to use to load textures and relative dependencies
Optionalcapacity: numberdefines the system capacity (if null or undefined the sotred capacity will be used)
Returns Promise<IParticleSystem>
a promise that will resolve to the new particle system
- snippetId: string
- (
StaticSnippet Url
Define the Url to load snippets
Methods
StaticCreate Async
-
CreateAsync(
type: string,
scene: Nullable<Scene>,
gpu?: boolean,
capacity?: number,
): Promise<ParticleSystemSet>This is the main static method (one-liner) of this helper to create different particle systems
Parameters
- type: string
This string represents the type to the particle system to create
- scene: Nullable<Scene>
The scene where the particle system should live
- gpu: boolean = false
If the system will use gpu
Optionalcapacity: numberdefines the system capacity (if null or undefined the sotred capacity will be used)
Returns Promise<ParticleSystemSet>
the ParticleSystemSet created
- type: string
StaticCreate Default
-
CreateDefault(
emitter: Nullable<AbstractMesh | Vector3>,
capacity?: number,
scene?: Scene,
useGPU?: boolean,
): IParticleSystemCreate a default particle system that you can tweak
Parameters
- emitter: Nullable<AbstractMesh | Vector3>
defines the emitter to use
- capacity: number = 500
defines the system capacity (default is 500 particles)
Optionalscene: Scenedefines the hosting scene
- useGPU: boolean = false
defines if a GPUParticleSystem must be created (default is false)
Returns IParticleSystem
the new Particle system
- emitter: Nullable<AbstractMesh | Vector3>
StaticExport Set
-
Static function used to export a particle system to a ParticleSystemSet variable. Please note that the emitter shape is not exported
Parameters
- systems: IParticleSystem[]
defines the particle systems to export
Returns ParticleSystemSet
the created particle system set
- systems: IParticleSystem[]
StaticParse From File Async
-
ParseFromFileAsync(
name: Nullable<string>,
url: string,
scene: Scene,
gpu?: boolean,
rootUrl?: string,
capacity?: number,
): Promise<IParticleSystem>Creates a particle system from a snippet saved in a remote file
Parameters
- name: Nullable<string>
defines the name of the particle system to create (can be null or empty to use the one from the json data)
- url: string
defines the url to load from
- scene: Scene
defines the hosting scene
- gpu: boolean = false
If the system will use gpu
- rootUrl: string = ""
defines the root URL to use to load textures and relative dependencies
Optionalcapacity: numberdefines the system capacity (if null or undefined the sotred capacity will be used)
Returns Promise<IParticleSystem>
a promise that will resolve to the new particle system
- name: Nullable<string>
StaticParse From Snippet Async
-
ParseFromSnippetAsync(
snippetId: string,
scene: Scene,
gpu?: boolean,
rootUrl?: string,
capacity?: number,
): Promise<IParticleSystem>Creates a particle system from a snippet saved by the particle system editor
Parameters
- snippetId: string
defines the snippet to load (can be set to _BLANK to create a default one)
- scene: Scene
defines the hosting scene
- gpu: boolean = false
If the system will use gpu
- rootUrl: string = ""
defines the root URL to use to load textures and relative dependencies
Optionalcapacity: numberdefines the system capacity (if null or undefined the sotred capacity will be used)
Returns Promise<IParticleSystem>
a promise that will resolve to the new particle system
- snippetId: string
This class is made for on one-liner static method to help creating particle system set.