Jump to content

Controlling particles via script?


saindd

Recommended Posts

Can you elaborate? The current system is pretty much bound to emitting particles in spherical volumes. It can't do more than that so if you mean you want to control specific particles individually through script then that is not currently possible without the ParticleRefactor afaik.


If you just want to spawn a ParticleEmitter, well then that's basically how you do it.

You can't spawn a ParticleEmitter by itself, what you need to do (if you're working purely from script) is to spawn a ParticleEmitterNode and mount it to the gun whereever you need it to be, and give the Node a reference to the desired ParticleEmitterDatablock.

Link to comment
Share on other sites

Can i control the spawned ParticleEmitter via script? Play, stop, change it's parameters? For example, i might want to randomize some of the properties, like velocity, etc.


Are there any examples of ParticleEmitterNode in the docs?

Link to comment
Share on other sites

Can i control the spawned ParticleEmitter via script? Play, stop, change it's parameters? For example, i might want to randomize some of the properties, like velocity, etc.


Are there any examples of ParticleEmitterNode in the docs?

 

The issue is that, all of those parameters are datablock-parameters. So it's messy to change those values at run-time, since it doesn't copy the values from the datablock, but uses the values directly from those datablocks.


There are plenty examples of both ParticleEmitterNode and ParticleEmitter here and there. You can use this part of my "Coin Collection Tutorial" for an introduction on how to create ParticleEmitter's at run-time. http://wiki.torque3d.org/coincollection:visualeffects

Link to comment
Share on other sites

Thanks. Do you think it's reasonable to use that as a muzzle-effect base or should i create a custom class? In UE, i use particles as muzzle flashes instead of meshes inside the models. This way, the same effect applies to both FP and TP.

Link to comment
Share on other sites

Link to comment
Share on other sites

That'll be coverded by http://imgur.com/vEp4z6F,2CjHW1m then by and large.


Do note that size[x] and time[x] are linked, so to use that one as an example, it starts at .4 size, halfway through the lifetime of a given particle it's at 1.2, and at the end it's about 1.7. Given it's time-based, variance in life time will put that at different sizes, though obviously, longer lasting particles will spread further out.


Spin min/max sets it up the parameters of the initial random distribution.


Liferandom for the *emitter* will give variance on the overarching particle system, not the individual ones.


Amount and amount random it should be noted are *frequency* settings, so lower = more spam.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...