Game Development Community

Changing particle properties on script.

by Joe Alanis · in Torque Game Builder · 01/13/2010 (7:14 pm) · 3 replies

I've looked this up on the reference but I can't find the way to edit a particle system properties in script.

How do i change properties like particle speed, rotation and life in code?

Please Help!

About the author

Director of the Animation and Digital Arts Bachelor @ ITESM Laguna Campus Twitter: @joealanis


#1
01/13/2010 (10:20 pm)
Let's assume your particle effect is named "PE". Then the following code would change the red life graph to 0.5 at time 0.
%pee = PE.getEmitterObject( 0 ); // Gets the first emitter in the particle
%pee.selectGraph( red_life ); // Selects the graph to modify
%pee.addDataKey( 0, 0.5 ); // Adds or changes a data point in the graph

The list of fields for the particle effects is here: tdn.garagegames.com/wiki/TGB/Reference:_t2dParticleEffect_Graph.

The list of fields for the particle emitters is here: tdn.garagegames.com/wiki/TGB/Reference:_t2dParticleEmitter_Graph.

Hope that helps!
#2
01/14/2010 (1:40 pm)
It does! thanks a lot!
#3
01/14/2010 (6:00 pm)
Manipulating particles in script dynamically can be a hugely powerful thing :)