Particle Molecule

Add a particle effect to the 3D scene.

Summary
Particle Molecule
Preference Dialog
Properties
typestring, ( r )
pref.namestring, ( r )
pref.enableWhenstring, ( r, w )
pref.disableWhenstring, ( r, w )
pref.shapestring, ( r, w )
pref.minAgefloat, ( r, w )
pref.maxAgefloat, ( r, w )
pref.frictionfloat, ( r, w )
pref.patternstring, ( r, w )
ratefloat, ( r, w )
speedfloat, ( r, w )
positionobject, ( r, w )
worldPositionobject, ( r )
velocityobject, ( w )
accelerationobject, ( w )
positionRangeobject, ( w )
velocityRangeobject, ( w )
accelerationRangeobject, ( w )
positionRadiusfloat, ( w )
velocityRadiusobject, ( w )
accelerationRadiusobject, ( w )
particleCountint, ( r )
affectorCountint, ( r )
volumefloat, ( r, w )
currentTimefloat, ( r )
durationfloat, ( r )
pannerobject, ( r )
statusstring, ( r )
Functions
attach
detach
delete
rename
clone
serialize
attachTo
detachFrom
start
stop
reset
destroy
attachSound
playSound
pauseSound
stopSound

Preference Dialog

Properties

type

string, ( r )

Type of this molecule, particle.

pref.name

string, ( r )

The scriptable name for this molecule.  This name can be set using rename function dynamically.

pref.enableWhen

string, ( r, w )

Specifies the event that activates this molecule.  Default is load.

pref.disableWhen

string, ( r, w )

Specifies the event that deactivates this molecule.  Default is none.

pref.shape

string, ( r, w )

Specifies the shape of particle spawner.  Can be ‘point, ‘cube’, or ‘sphere’.  Default to ‘point’.

pref.minAge

float, ( r, w )

Specifies the particles’ minimum age in seconds.

pref.maxAge

float, ( r, w )

Specifies the particles’ maximum age in seconds.

pref.friction

float, ( r, w )

Specifies the overall friction that is applied to all particles.  Default is 1.0 (none).  Value smaller than 1.0 will slow down particle over time.

pref.pattern

string, ( r, w )

Specifies the spawning pattern.  It is eitehr steady rate or one shot.

rate

float, ( r, w )

Specifies rate of spawning in number of particles per second.

speed

float, ( r, w )

Specifies the overall speed of particles.

position

object, ( r, w )

Gets/Sets the position of the spawner in Vector3.

worldPosition

object, ( r )

Returns the world position of the spawner.

velocity

object, ( w )

If the spawner shape is a point, specifies the velocity, in Vector3, of spawned particles.

acceleration

object, ( w )

If the spawner shape is a point, specifies the acceleration, in Vector3, of spawned particles.

positionRange

object, ( w )

If the spawner shape is a cube, specifies the size of the cube wherein particles’ position vectors are randomly generated.

velocityRange

object, ( w )

If the spawner shape is a cube, specifies the size of the cube wherein the particles’ velocity vectors are randomly generated.

accelerationRange

object, ( w )

If the spawner shape is a cube, specifies the size of the cube wherein the particles’ acceleration vectors are randomly generated.

positionRadius

float, ( w )

If the spawner shape is a sphere, specifies its radius wherein particles’ position vectors are randomly generated.

velocityRadius

object, ( w )

If the spawner shape is a sphere, specifies its radius wherein the particles’ velocity vectors are randomly generated.

accelerationRadius

object, ( w )

If the spawner shape is a spere, specifies its radius wherein the particles’ acceleration vectors are randomly generated.

particleCount

int, ( r )

Returns the number of particles.  The spawner uses this pool of paricles of fixed size to generate the effect.

affectorCount

int, ( r )

Returns the number of affectors.

volume

float, ( r, w )

If a web audio sound souce is attached to this molecule, gets/sets its current sound volume.

currentTime

float, ( r )

Returns the current playback position of a web audio sound track.

duration

float, ( r )

Returns the duration of the attached web audio sound track in seconds.

panner

object, ( r )

Returns the web audio sound panner object.

status

string, ( r )

Returns the current web audio playback status, playing, stopped, paused.

Functions

attach

attach(droplet);

Attach this molecule to the given droplet.

Parameters

droplet(object) a droplet.

Returns

N/A

detach

detach();

Remove this molecule from its droplet.

Parameters

N/A

Returns

N/A

delete

delete();

Delete this molecule.

Parameters

N/A

Returns

N/A

rename

rename(name);

Rename this molecule.

Parameters

name(string) a new name.

Returns

N/A

clone

clone();

Create a clone of this molecule.

Parameters

N/A

Returns

(object) a molecule.

serialize

serialize();

Serialize this molecule into its JSON representation.

Parameters

N/A

Returns

(string) JSON representation of a molecule.

attachTo

attachTo(entity);

Attach this particle spawner to the given 3D entity.

Parameters

entity(object) a mesh or manualobject.

Returns

N/A

detachFrom

detachFrom();

Detach this particle spawner from its parent, if any.

Parameters

N/A

Returns

N/A

start

start();

Start the particle spawner.

Parameters

N/A

Returns

N/A

stop

stop();

Stop the particle spawner.

Parameters

N/A

Returns

N/A

reset

reset();

Reset the particle spawner to its initial state.

Parameters

N/A

Returns

N/A

destroy

destroy();

Destroy the particle spawner.

Parameters

N/A

Returns

N/A

attachSound

attachSound(url);

Attach a sound source at given URL to this particle spawner.

Parameters

url(string) a valid http URL or a private vault URL that starts with //.

Returns

N/A

playSound

playSound(start_time, toLoop);

Play the sound source beginning from the given start_time.

Parameters

start_time(float) place in sound track to start the playback in seconds.
toLoop(bool) repeat the sound track.

Returns

N/A

pauseSound

pauseSound(end_time);

Pause the sound playback at the given end_time.  Use playSound to resume.

Parameters

end_time(float) place in sound track to pause the playback in seconds.

Returns

N/A

stopSound

stopSound(end_time);

Stop the sound playback at the given end_time.  Calling playSound again will start from time 0.

Parameters

end_time(float) place in sound track to stop the playback in seconds.

Returns

N/A

Close