Skip to content

niParticleSystemController⚓︎

The niParticleSystemController animates an niParticles-based object. The controller handles birth and death, spawning and motion.

A particle spawn can be set to occur when the particle undergoes a specific condition, such as colliding with an object or dying. When such an event happens, naw particles are generated at the position of the old particle with the same attributes as the original particle. This behaviour will continue until the number of spawn generations equals the number of generations allowed. The number of new particles, precentage of particles that undergo spawning, speed and directional chaos values can be specified.

This type inherits the following: niTimeController, niObject

Properties⚓︎

active⚓︎

If the controller is active. When inactive, the target does not get updated and animation timing does not advance.

Returns:

  • result (boolean)

activeParticleCount⚓︎

Read-only. The number of active particles in the initial particles array.

Returns:

  • result (integer)

animTimingType⚓︎

How the time parameter passed to the update function is treated. Type 0 is the default, which treats the update time as a delta time. Type 1 treats the update time an offset from the start of the animation.

Maps to values in ni.animType table.

Returns:


birthRate⚓︎

The rate at which new particles are generated.

Returns:

  • result (number)

currentParticleIndex⚓︎

Read-only.

Returns:

  • result (integer)

cycleType⚓︎

The animation cycle type. Type 0 is looping, type 2 is reverse, type 4 is clamped.

Maps to values in ni.animCycleType table.

Returns:


declinationAngle⚓︎

The declination angle of the velocity vector of newly spawned particles from the positive Z axis in radians. The range is [0, PI], where declination angle of 0 will set the initial velocity vector to [0, 0, 1]. Declination angle of PI will set the initial velocity vector to [0, 0, -1].

Returns:

  • result (number)

declinationAngleVariation⚓︎

The variation of the initial declination angle. The initial velocity declination will be evenly distributed over the [.declinationAngle - .declinationAngleVariation / 2, .declinationAngle + .declinationAngleVariation / 2] range.

Returns:

  • result (number)

emitStartTime⚓︎

The time value at which the niParticleSystemController will start emitting particles. If this value is less than the .startTime variable (inherited from niTimeController), the controller will perform a run-up for the amount of time indicated by the difference.

Returns:

  • result (number)

emitStopTime⚓︎

The time value at which the controller stops emitting the particles.

Returns:

  • result (number)

emitter⚓︎

The object that emits the particles. The emitter volume is transformed into the world coordinates of the emitter before new particles are generated. This allows the transforms of the emitter to change without affecting the transforms of all the particles in the system.

Returns:


emitterDepth⚓︎

Determines the dimensions of the volume from which new particles are generated.

Returns:

  • result (number)

emitterHeight⚓︎

Determines the dimensions of the volume from which new particles are generated.

Returns:

  • result (number)

emitterModifiers⚓︎

Modifiers that will influence the particle system by modifying the emmiting object.

Returns:


emitterWidth⚓︎

Determines the dimensions of the volume from which new particles are generated.

Returns:

  • result (number)

firstTime⚓︎

Returns:

  • result (integer)

frequency⚓︎

The animation controller's frequency value. It is a scaling value used to convert from update time units to keyframe time units, if necessary.

Returns:

  • result (number)

highKeyFrame⚓︎

This is the end animation key time of the animation controller.

Returns:

  • result (number)

initialColor⚓︎

The initial color given to the newly created particles.

Returns:


initialNormal⚓︎

Default: {1.0, 0.0, 0.0}. The normal vector given to the newly created particles.

Returns:


initialSize⚓︎

The initial size of the new particles.

Returns:

  • result (number)

lastEmit⚓︎

The timestamp at which the last emitted particles were created.

Returns:

  • result (number)

lastScaledTime⚓︎

This function returns the last scaled time computed by this controller. The scaled time takes the frequency and phase into account, along with the cycleType and animTimingType. This is the last value used to interpolate animation keys.

Returns:

  • result (number)

lastTime⚓︎

No description.

Returns:

  • result (number)

lifespan⚓︎

The life spane for each particle.

Returns:

  • result (number)

lifespanVariance⚓︎

The variation of the particle life span. It will be evenly distributed over the [.lifespan - .lifespanVariance / 2, .lifespan + .lifespanVariance / 2] range.

Returns:

  • result (number)

lowKeyFrame⚓︎

This is the beginning animation key time of the animation controller.

Returns:

  • result (number)

nextController⚓︎

The next animation controller in the list of controllers containing the calling controller.

Returns:


particleColliders⚓︎

Collider modifiers that will influence the individual particles.

Returns:


particleDataCount⚓︎

Read-only. The number of initial particles.

Returns:

  • result (integer)

particleModifiers⚓︎

Modifiers that will influence the individual particles.

Returns:


phase⚓︎

The phase value. It is an offset applied to the animation's update time, in seconds.

Returns:

  • result (number)

planarAngle⚓︎

The planar angle (around the Z axis from the positive X axis) that will serve as the plane in which the declination will occur. The expected range of the planar angle is [0, 2PI).

Returns:

  • result (number)

planarAngleVariation⚓︎

The variation of the initial planar angle. The planar angle will be evenly distributed over the [.planarAngle - .planarAngleVariation / 2, .planarAngle + .planarAngleVariation / 2] range.

Returns:

  • result (number)

refCount⚓︎

Read-only. The number of references that exist for this object. When this value reaches zero, the object will be deleted.

Returns:

  • result (number)

resetParticleSystem⚓︎

Controls whether the system will be reset when the niParticleSystemController loops. If this flag is set to true, existing particles will be eliminated when the controller loops, and any run-up indicated by .emitStartTime variable will occur. Otherwise, the controller will simply continue running from the beginning of the loop, and the existing particles will continue to run until they die out naturally.

Returns:

  • result (boolean)

RTTI⚓︎

Read-only. The runtime type information for this object. This is an alias for the .runTimeTypeInformation property.

Returns:


runTimeTypeInformation⚓︎

Read-only. The runtime type information for this object.

Returns:


scaledLastTime⚓︎

Returns:

  • result (number)

spawnDirectionChaos⚓︎

Controls the change in direction that new particles generated by a spawn event will have. A value of 0.0 indicates no change in direction, and a value of 1.0 indicates a 0 % to 100 % change in direction.

Returns:

  • result (number)

spawnGenerationsCount⚓︎

The number of spawn generations a particle can go through.

Returns:

  • result (integer)

spawnMultiplier⚓︎

The number of new particles generated on a spawn event.

Returns:

  • result (integer)

spawnOnDeath⚓︎

This flag indicates whether a particle spawn event will occur upon particle death.

Returns:

  • result (boolean)

spawnPercentage⚓︎

The percentage of the particles that will actually spawn when a spawn event occurs Expected values are in range [0.0, 1.0].

Returns:

  • result (number)

spawnSpeedChaos⚓︎

Controls the change in speed that new particles generated by a spawn event will have. A value of 0.0 indicates no change in speed, a value of 1.0 indicates a 0 % to 100 % increase in speed, and a value of -1.0 indicates 0 % to 100 % decrease in speed.

Returns:

  • result (number)

speed⚓︎

This is the initial speed of the newly spawned particles.

Returns:

  • result (number)

speedVariation⚓︎

The variation of the initial velocity. The initial velocity will be evenly distributed over the [.speed - .speedVariation / 2, .speed + .speedVariation / 2] range.

Returns:

  • result (number)

startTime⚓︎

The time at which the animation controller starts playing its animation.

Returns:

  • result (number)

staticBounds⚓︎

This flag controls whether or not the controller uses precomputed static bounding volumes for each frame of the animation.

Returns:

  • result (boolean)

target⚓︎

Read-only. The scene graph object that this animation controller is to animate.

Returns:


useBirthRate⚓︎

If this flag is set to false, the maximal sustainable birth rate based on the life span of the particles will be used. Otherwise, the value of .birthRate property will be used.

Returns:

  • result (boolean)

Methods⚓︎

clone⚓︎

Creates a copy of this object.

local result = myObject:clone()

Returns:


isInstanceOfType⚓︎

Determines if the object is of a given type, or of a type derived from the given type.

local result = myObject:isInstanceOfType(type)

Parameters:

Returns:

  • result (boolean)

isOfType⚓︎

Determines if the object is of a given type.

local result = myObject:isOfType(type)

Parameters:

Returns:

  • result (boolean)

saveBinary⚓︎

Serializes the object, and writes it to the given file.

local success = myObject:saveBinary(path)

Parameters:

  • path (string): The path to write the file at, relative to the Morrowind installation folder.

Returns:

  • success (boolean): If true the object was successfully serialized.

setTarget⚓︎

This method assigns a new target to the animation controller.

myObject:setTarget(target)

Parameters:


start⚓︎

Starts the controller at the specified time. Intended for controllers with animTimingType of 1.

myObject:start(time)

Parameters:

  • time (number)

stop⚓︎

Stops the controller. If you only want to pause the controller, use the update property.

myObject:stop()