Game Development Community

Muzzle Flash in Milkshape

by Chris Byars · in Torque Game Engine · 04/16/2005 (8:23 am) · 5 replies

Could someone please explain how to add a muzzle flash/anim in Milkshape? I have the texture and all, and have a weapon that uses it, however I don't have the source .ms3d file to look off of, so in my new weapon model, I am unsure of how to add the muzzle flash to the model.

Thanks a ton.

#1
04/16/2005 (9:36 am)
Attach it as an animated texture to the fire animation.
#2
04/16/2005 (9:53 am)
Yeah, but, how?
#3
04/16/2005 (3:13 pm)
I suggest to use the built in particle system:

you have to mount one (or more - at least I suppose torque can handle more than one) muzzle point to your weapon and then script in your_weapon.cs a datablock that fires the ejection of particles from the muzzle point and defines their properties :

i.e.

datablock ParticleData(your_weapon_muzzle_emitter)
{
   textureName          = "~/data/shapes/your_weapons/your_weapon_muzzle_texture";

   dragCoefficient     = x.x;
   gravityCoefficient   = x.x;  // if  you set this value to a negative one the particle will rise
   inheritedVelFactor   = x.x;

   lifetimeMS           = xx;   // Time in ms
   lifetimeVarianceMS   = xx;    // ...more or less time in ms

   useInvAlpha =                       //false or true;
   spinRandomMin = --xx.x;
   spinRandomMax = xx.x;

// define color of particles

   colors[0]     = "1 1 0.4 1.0";
   colors[1]     = "1 0.2 0.9 1.0";
   colors[2]     = "0 0 0 0";

// define size of particles

   sizes[0]      = x.x;
   sizes[1]      = x.x;
   sizes[2]      = x.x;

};

Obviously remove the xx and play with some real values to see what's happening.. (you may see some hints looking at the crossbow.cs file);

Anyway I strongly suggest you to read carefully the Torque docs relative to datablocks and particle systems.
They (the particles) are so useful that, for example, the muzzle flashes of Far Cry (which are among the best I've ever seen) were made using this approach.

Hope it helps

Edit : typos
#4
04/16/2005 (10:50 pm)
Also check this.
#5
04/17/2005 (5:47 pm)
*slaps self*

Thanks for pointing me to the obvious, lol, I didn't think of simply using the particle system.