Particle Systems
setParticleEmitRate
setParticleEmitRate(particleSystemId: string, rate: number, [callback: Function])
Sets the emit rate for a particle system. This controls how many particles are emitted per second.
The particleSystemId
is the ID of the particle system, which can be found in the scene's particle system list.
api.setParticleEmitRate('particle_system_id', 10, function() {
console.log('Particle emit rate updated to 10 particles per second');
});
2
3
setParticleUpdateSpeed
setParticleUpdateSpeed(particleSystemId: string, speed: number, [callback: Function])
Sets the update speed for a particle system. This controls how fast the particle animation plays.
The particleSystemId
is the ID of the particle system. The speed
is a multiplier (1.0 = normal speed, 2.0 = double speed, 0.5 = half speed).
api.setParticleUpdateSpeed('particle_system_id', 2.0, function() {
console.log('Particle update speed changed to 2x');
});
2
3
startParticleSystem
startParticleSystem(particleSystemId: string, [callback: Function])
Starts a particle system. This begins the emission and animation of particles.
The particleSystemId
is the ID of the particle system to start.
api.startParticleSystem('particle_system_id', function() {
console.log('Particle system started');
});
2
3
stopParticleSystem
stopParticleSystem(particleSystemId: string, [callback: Function])
Stops a particle system. This stops the emission of new particles, but existing particles will continue to animate until they expire.
The particleSystemId
is the ID of the particle system to stop.
api.stopParticleSystem('particle_system_id', function() {
console.log('Particle system stopped');
});
2
3
Finding Particle System IDs
To find the IDs of particle systems in your scene, you can use the getNodeList function and look for nodes with particle system components, or check the scene configuration in the rooom editor.
api.getNodeList(function(nodes) {
nodes.forEach(function(node) {
if (node.type === 'ParticleSystem') {
console.log('Found particle system:', node.id, node.name);
}
});
});
2
3
4
5
6
7