Particle Emitter for Item
by Grant McNeil · in Torque Game Engine · 10/13/2003 (10:17 am) · 6 replies
Hello Garagegames,
Right now i'm trying to add particle emitter functionality to items in torque.
Its pretty much using the same code that the projectile class uses for its particle emitter capability. its all in, and it all compiles, but like always, theres a catch.
when I add in "particleEmitter = "EnergyEmitter";" to my Grenade ItemData datablock, the loading screen freezes when its half done loading. If I comment it out, loads fine.
similarly, if I keep "particleEmitter = "EnergyEmitter";" uncommented, but in the code comment out the packdata and unpackdata methods for the particle engine, it load fine.
Does anyone know what may be causing this loading screen error? thanks,
--Grant
By the way,
If you need more detail on a certain point, please ask.
Right now i'm trying to add particle emitter functionality to items in torque.
Its pretty much using the same code that the projectile class uses for its particle emitter capability. its all in, and it all compiles, but like always, theres a catch.
when I add in "particleEmitter = "EnergyEmitter";" to my Grenade ItemData datablock, the loading screen freezes when its half done loading. If I comment it out, loads fine.
similarly, if I keep "particleEmitter = "EnergyEmitter";" uncommented, but in the code comment out the packdata and unpackdata methods for the particle engine, it load fine.
Does anyone know what may be causing this loading screen error? thanks,
--Grant
By the way,
If you need more detail on a certain point, please ask.
About the author
#2
Sorry if I misunderstood you, but...
Do you mean in script or in the engine? I know that the Item class doesn't support particles, but I worked around this by adding a mount point to my item and then mounting a shape image that had an emitter on it (in script).
Hope this helps...
John.
10/14/2003 (12:45 pm)
Hi Grant,Sorry if I misunderstood you, but...
Quote: when I add in "particleEmitter = "EnergyEmitter";" to my Grenade ItemData datablock
Do you mean in script or in the engine? I know that the Item class doesn't support particles, but I worked around this by adding a mount point to my item and then mounting a shape image that had an emitter on it (in script).
Hope this helps...
John.
#3
Why don't you just add an emitter in the code or create a particlemitternode on the scripts (Item's onAdd).
10/14/2003 (5:11 pm)
@Bob: ewwww.... that sounds expensive ... (CPU wise).Why don't you just add an emitter in the code or create a particlemitternode on the scripts (Item's onAdd).
#4
You can add an emitter for Items, without items having the code to take emitters? I mean, Projectiles you just need to define the particle datablock, the particleemitter datablock, and define it in the projectile and its all good.
what function do you use to create a particlemitternode? If it does what you say it does, I can just use a particlemitternode and attach it to the objects, instead of having it set up like the projectile particle system.
So, wanna tell me how to do it? any tutorials you can point me to?
Thanks,
--Grant
10/14/2003 (5:48 pm)
Hey,You can add an emitter for Items, without items having the code to take emitters? I mean, Projectiles you just need to define the particle datablock, the particleemitter datablock, and define it in the projectile and its all good.
what function do you use to create a particlemitternode? If it does what you say it does, I can just use a particlemitternode and attach it to the objects, instead of having it set up like the projectile particle system.
So, wanna tell me how to do it? any tutorials you can point me to?
Thanks,
--Grant
#5
Ya its ugly, but I only needed it for one object (literally one instance) and the scripting took about five minutes. :)
Grant,
I added a 'mount0' node to the items dts (the same way you would with a character model). Then I created a second dts with only a 'mountpoint' and a 'muzzlepoint' (just like a weapon). The emitter object's (the second object) datablock is setup to emit constant particles from the muzzlepoint. In script when the item is created just create and mount the emitter object. Works great.
As Xavier pointed out this is a little much considering the emitter code could be copied from another object class, however for a simple one of effect it took five minutes and required no debugging.
John.
10/14/2003 (9:19 pm)
Xavier,Ya its ugly, but I only needed it for one object (literally one instance) and the scripting took about five minutes. :)
Grant,
I added a 'mount0' node to the items dts (the same way you would with a character model). Then I created a second dts with only a 'mountpoint' and a 'muzzlepoint' (just like a weapon). The emitter object's (the second object) datablock is setup to emit constant particles from the muzzlepoint. In script when the item is created just create and mount the emitter object. Works great.
As Xavier pointed out this is a little much considering the emitter code could be copied from another object class, however for a simple one of effect it took five minutes and required no debugging.
John.
#6
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4273
10/14/2003 (9:22 pm)
Oh, a great dts reference:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4273
Torque Owner Grant McNeil
*bump*...
--Grant