Particle Molecule
From oWiki
Preference Dialog
Attributes
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 method dynamically.
pref.script
string ( r, w )
The particle system script. Particle systems which are defined in scripts are used as templates, and multiple actual systems can be created from them at runtime.
pref.x
string ( r, w )
The x-coordinate of the particle system position.
pref.y
string ( r, w )
The y-coordinate of the particle system position.
pref.z
string ( r, w )
The z-coordinate of the particle system position.
renderQueueGroup
int ( r, w )
Gets/Sets the rendering queue position of this particle. Render queues are grouped to allow you to more tightly control the ordering of rendered objects. If you do not call this method, all Entity objects default to the default queue, which is fine for most objects. You may want to alter this if you want this entity to always appear in front of other objects, e.g. for a 3D menu system or such.
renderingDistance
float ( r, w )
Gets/Sets the distance at which the object is no longer rendered.
numEmitters
int ( r, w )
Returns the number of emitters for this particle system.
numAffectors
int ( r, w )
Returns the number of affectors for this particle system.
numParticles
int ( r, w )
Gets the number of individual particles in the system right now.
The number of particles active in a system at a point in time depends on the number of emitters, their emission rates, the time-to-live (TTL) each particle is given on emission (and whether any affectors modify that TTL) and the maximum number of particles allowed in this system at once (particle quota).
particleQuota
int ( r, w )
Gets/Sets the maximum number of particles this system is allowed to have active at once.
Particle systems all have a particle quota, i.e. a maximum number of particles they are allowed to have active at a time. This allows the application to set a keep particle systems under control should they be affected by complex parameters which alter their emission rates etc. If a particle system reaches it's particle quota, none of the emitters will be able to emit any more particles. As existing particles die, the spare capacity will be allocated equally across all emitters to be as consistent to the original particle system style as possible.
emittedEmitterQuota
int ( r, w )
Gets/Sets the maximum number of emitted emitters this system is allowed to have active at once.
Particle systems can have - besides a particle quota - also an emitted emitter quota.
materialName
string ( r, w )
Gets/Sets the name of the material to be used for this particle system.
speedFactor
float ( r, w )
Gets/Sets a speed factor on this particle system, which means it scales the elapsed real time which has passed by this factor before passing it to the emitters, affectors, and the particle life calculation.
An interesting side effect - if you want to create a completely manual particle system where you control the emission and life of particles yourself, you can set the speed factor to 0.0f, thus disabling normal particle emission, alteration, and death.
volume
float, [0.0, 1.0] ( r, w )
Gets/Sets the volume of the sound attached to this particle system.
currentTime
float ( r, w )
Gets/Sets the playback position (in secs) of the sound attached to this particle system.
duration
float ( r )
Gets the duration (in secs) of the sound attached to this particle system.
status
int ( r )
Polls for the current sound playing status.
Possible return values are:
| Value | Description |
|---|---|
| AL_PLAYING | A sound track is playing. |
| AL_STOPPED | Sound track has stopped. |
Methods
rename(n)
n: string
| Rename this molecule. |
update()
| Force molecule to redraw with the current set of attributes. |
clone()
Return: a molecule
| Create a clone of this molecule. |
attach(droplet)
droplet: a droplet object (e.g. app.box.droplet)
| Attach this molecule to a droplet. |
detach()
| Remove this molecule from its droplet. |
deleteMod()
| Delete this molecule. |
serialize()
Return: string
| Serialize this molecule into its JSON representation. |
setScript( script )
script: string
| Update the particle system by loading a new particle system script. |
addEmitter( type )
type: string
Return: a ParticleEmitter
| Adds an emitter to this particle system. |
| type: string identifying the emitter type to create. |
getEmitter( i )
i: int
Return: a ParticleEmitter
| Retrieves an emitter by it's index (zero-based). |
removeEmitter( i )
i: int
| Removes an emitter from the system. |
removeAllEmitters()
| Removes all emitters from the system. |
addAffector( type )
type: string
Return: a ParticleAffector
| Adds an affector to this particle system. |
| type: string identifying the emitter type to create. |
getAffector( i )
i: int
Return: a ParticleAffector
| Retrieves an affector by it's index (zero-based). |
removeAffector( i )
i: int
| Removes an affector from the system. |
removeAllAffectors()
| Removes all affectors from the system. |
clear()
| Empties this set of all particles. |
setDefaultDimensions( w, h )
w: float
h: float
| Sets the default dimensions of the particles in this set. |
| All particles in a set are created with these default dimensions. The set will render most efficiently if all the particles in the set are the default size. It is possible to alter the size of individual particles at the expense of extra calculation. |
isAttached()
Return: bool
| Returns true if this object is attached to a SceneNode or TagPoint. |
detachFromParent()
| Detaches an object from a parent SceneNode or TagPoint, if attached. |
setPosition( pos )
pos: Vector3
| Sets the position of the particle system. |
fastForward( time, interval )
time: float
interval: float
| Fast-forwards this system by the required number of seconds. |
| This method allows you to fast-forward a system so that it effectively looks like it has already been running for the time you specify. This is useful to avoid the 'startup sequence' of a system, when you want the system to be fully populated right from the start. |
| time: The number of seconds to fast-forward by. |
| interval: The sampling interval used to generate particles, apply affectors etc. The lower this is the more realistic the fast-forward, but it takes more iterations to do it. |
attachSound( url )
url: string
| Attach an audio track to this particle system, replace the existing one if any. The attached audio moves with the system during animation and creates 3D sound effect. Use Camera.listen() to hear the sound effects. |
playSound( loop )
loop: bool
| Play the attached sound track, loops if necessary. |
pauseSound()
| Pause the sound track. |
stopSound()
| Stop the sound track. |
rewindSound()
| Rewind the sound track to the beginning. |
attachTo( entity )
entity: molecule
| Attach this particle system to another 3D entity in scene. |
detachFrom( entity )
entity: molecule (optional)
| Detach this particle system from another 3D entity in scene. |

