Create a new ParticleSystemComponent.
The ComponentSystem that created this Component.
The Entity this Component is attached to.
The Entity that this Component is attached to.
The ComponentSystem used to create this Component.
Gets whether particles are oriented in their direction of motion or not.
Sets whether particles are oriented in their direction of motion or not.
Gets the index of the animation to play.
Sets the index of the animation to play. When animNumAnimations
is greater than 1, the
sprite sheet animation index determines which animation the particle system should play.
Gets whether the sprite sheet animation plays once or loops continuously.
Sets whether the sprite sheet animation plays once or loops continuously.
Gets the number of sprite sheet animations contained within the current sprite sheet.
Sets the number of sprite sheet animations contained within the current sprite sheet. The
number of animations multiplied by number of frames should be a value less than animTilesX
multiplied by animTilesY
.
Gets the number of sprite sheet frames in the current sprite sheet animation.
Sets the number of sprite sheet frames in the current sprite sheet animation. The number of
animations multiplied by number of frames should be a value less than animTilesX
multiplied by animTilesY
.
Gets the sprite sheet animation speed.
Sets the sprite sheet animation speed. 1 = particle lifetime, 2 = double the particle lifetime, etc.
Gets the sprite sheet frame that the animation should begin playing from.
Sets the sprite sheet frame that the animation should begin playing from. Indexed from the start of the current animation.
Gets the number of horizontal tiles in the sprite sheet.
Sets the number of horizontal tiles in the sprite sheet.
Gets the number of vertical tiles in the sprite sheet.
Sets the number of vertical tiles in the sprite sheet.
Gets whether the particle system plays automatically on creation.
Sets whether the particle system plays automatically on creation. If set to false, it is necessary to call ParticleSystemComponent#play for the particle system to play. Defaults to true.
Gets how particles are blended when being written to the currently active render target.
Sets how particles are blended when being written to the currently active render target. Can be:
Gets whether depth softening is enabled.
Sets whether depth softening is enabled. Controls fading of particles near their intersections with scene geometry. This effect, when it's non-zero, requires scene depth map to be rendered. Multiple depth-dependent effects can share the same map, but if you only use it for particles, bear in mind that it can double engine draw calls.
Gets whether depth writes is enabled.
Sets whether depth writes is enabled. If enabled, the particles will write to the depth buffer. If disabled, the depth buffer is left unchanged and particles will be guaranteed to overwrite one another in the order in which they are rendered.
Gets the draw order of the component.
Sets the draw order of the component. A higher value means that the component will be rendered on top of other components in the same layer. This is not used unless the layer's sort order is set to SORTMODE_MANUAL.
Gets the extents of a local space bounding box within which particles are spawned at random positions.
Sets the extents of a local space bounding box within which particles are spawned at random
positions. This only applies to particle system with the shape EMITTERSHAPE_BOX
.
Gets the exception of extents of a local space bounding box within which particles are not spawned.
Sets the exception of extents of a local space bounding box within which particles are not
spawned. It is aligned to the center of emitterExtents. This only applies to particle system
with the shape EMITTERSHAPE_BOX
.
Gets the radius within which particles are spawned at random positions.
Sets the radius within which particles are spawned at random positions. This only applies to
particle system with the shape EMITTERSHAPE_SPHERE
.
Gets the inner radius within which particles are not spawned.
Sets the inner radius within which particles are not spawned. This only applies to particle
system with the shape EMITTERSHAPE_SPHERE
.
Gets the shape of the emitter.
Sets the shape of the emitter. Defines the bounds inside which particles are spawned. Also affects the direction of initial velocity.
Gets the enabled state of the component.
Sets the enabled state of the component.
Gets whether Half Lambert lighting is enabled.
Sets whether Half Lambert lighting is enabled. Enabling Half Lambert lighting avoids particles looking too flat in shadowed areas. It is a completely non-physical lighting model but can give more pleasing visual results.
Gets the magnitude of the initial emitter velocity.
Sets the magnitude of the initial emitter velocity. Direction is given by emitter shape.
Gets the color multiplier.
Sets the color multiplier.
Gets the array of layer IDs (Layer#id) to which this particle system belongs.
Sets the array of layer IDs (Layer#id) to which this particle system should belong. Don't push/pop/splice or modify this array. If you want to change it, set a new one instead.
Gets the length of time in seconds between a particle's birth and its death.
Sets the length of time in seconds between a particle's birth and its death.
Gets whether particles will be lit by ambient and directional lights.
Sets whether particles will be lit by ambient and directional lights.
Gets whether particles move with respect to the emitter's transform rather then world space.
Sets whether particles move with respect to the emitter's transform rather then world space.
Gets whether the particle system loops.
Sets whether the particle system loops.
Gets whether fogging is ignored.
Sets whether fogging is ignored.
Gets the normal map texture to apply to all particles in the system.
Sets the normal map texture to apply to all particles in the system. If no texture is assigned, an approximate spherical normal is calculated for each vertex.
Gets the maximum number of simulated particles.
Sets the maximum number of simulated particles.
Gets the particle orientation mode.
Sets the particle orientation mode. Can be:
Gets whether the particle system will be initialized as though it has already completed a full cycle.
Sets whether the particle system will be initialized as though it has already completed a full cycle. This only works with looping particle systems.
Gets the second radial speed graph.
Sets the second radial speed graph. If not null, particles pick random values between radialSpeedGraph and radialSpeedGraph2. Velocity vector points from emitter origin to particle position.
Gets whether each particle emitted by the system will play a random animation from the
sprite sheet, up to animNumAnimations
.
Sets whether each particle emitted by the system will play a random animation from the
sprite sheet, up to animNumAnimations
.
Gets the minimal interval in seconds between particle births.
Sets the minimal interval in seconds between particle births.
Gets the maximal interval in seconds between particle births.
Sets the maximal interval in seconds between particle births.
Gets whether particles are rendered in 2D screen space.
Sets whether particles are rendered in 2D screen space. This needs to be set when particle system is part of hierarchy with ScreenComponent as its ancestor, and allows particle system to integrate with the rendering of ElementComponents. Note that an entity with ParticleSystem component cannot be parented directly to ScreenComponent, but has to be a child of a ElementComponent, for example LayoutGroupComponent.
Gets the particle sorting mode.
Sets the particle sorting mode. Forces CPU simulation, so be careful.
Gets the minimal initial Euler angle of a particle.
Sets the minimal initial Euler angle of a particle.
Gets the maximal initial Euler angle of a particle.
Sets the maximal initial Euler angle of a particle.
Gets how much particles are stretched in their direction of motion.
Sets how much particles are stretched in their direction of motion. This is a value in world units that controls the amount by which particles are stretched based on their velocity. Particles are stretched from their center towards their previous position.
Gets whether particles wrap based on the set wrap bounds.
Sets whether particles wrap based on the set wrap bounds.
Gets the wrap bounds of the particle system.
Sets the wrap bounds of the particle system. This is half extents of a world space box volume centered on the owner entity's position. If a particle crosses the boundary of one side of the volume, it teleports to the opposite side.
Fire an event, all additional arguments are passed on to the event listener.
Name of event to fire.
Optional
arg1: anyFirst argument that is passed to the event handler.
Optional
arg2: anySecond argument that is passed to the event handler.
Optional
arg3: anyThird argument that is passed to the event handler.
Optional
arg4: anyFourth argument that is passed to the event handler.
Optional
arg5: anyFifth argument that is passed to the event handler.
Optional
arg6: anySixth argument that is passed to the event handler.
Optional
arg7: anySeventh argument that is passed to the event handler.
Optional
arg8: anyEighth argument that is passed to the event handler.
Self for chaining.
Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event, if scope is not provided then all events with the callback will be unbound.
Optional
name: stringName of the event to unbind.
Optional
callback: HandleEventCallbackFunction to be unbound.
Optional
scope: objectScope that was used as the this when the event is fired.
Self for chaining.
const handler = function () {
};
obj.on('test', handler);
obj.off(); // Removes all events
obj.off('test'); // Removes all events called 'test'
obj.off('test', handler); // Removes all handler functions, called 'test'
obj.off('test', handler, this); // Removes all handler functions, called 'test' with scope this
Attach an event handler to an event.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optional
scope: object = ...Object to use as 'this' when the event is fired, defaults to current this.
Can be used for removing event in the future.
Attach an event handler to an event. This handler will be removed after being fired once.
Name of the event to bind the callback to.
Function that is called when event is fired. Note the callback is limited to 8 arguments.
Optional
scope: object = ...Object to use as 'this' when the event is fired, defaults to current this.
Used to simulate particles and produce renderable particle mesh on either CPU or GPU. GPU simulation is generally much faster than its CPU counterpart, because it avoids slow CPU-GPU synchronization and takes advantage of many GPU cores. However, it requires client to support reasonable uniform count, reading from multiple textures in vertex shader and OES_texture_float extension, including rendering into float textures. Most mobile devices fail to satisfy these requirements, so it's not recommended to simulate thousands of particles on them. GPU version also can't sort particles, so enabling sorting forces CPU mode too. Particle rotation is specified by a single angle parameter: default billboard particles rotate around camera facing axis, while mesh particles rotate around 2 different view-independent axes. Most of the simulation parameters are specified with Curve or CurveSet. Curves are interpolated based on each particle's lifetime, therefore parameters are able to change over time. Most of the curve parameters can also be specified by 2 minimum/maximum curves, this way each particle will pick a random value in-between.