Game Development Community

Projectile Emitter and initial velocity

by Lukas Joergensen · in Technical Issues · 04/09/2009 (3:02 am) · 0 replies

I know i hae started a similar thread but i did not get any answers and just guessed that maybe i had to do it another way..
So now i followed the thread instructions here
But then i had a problem cuz' at some angles it shot to one side like this [image]http://clan-net.dk/images/screenshot_001-00001.png[/url]
And as you also can see on the picture there are no particles on the arrow as there should be:

New Projectile Code
%eyeVector = VectorNormalize(%clientplayer.getEyeVector());  
      %eyePoint = VectorNormalize(%clientplayer.getEyePoint());  
  
      %scaledEyeVector = VectorScale(%eyeVector, 60);  
   
      %location = VectorAdd(%eyePoint, %scaledEyeVector); 
      
     %muzzleVelocity = VectorAdd(%location, 30);
      %bullet = new Projectile() {
            dataBlock = SampleSpellProjectile;
vectorNormalize(%clientplayer.getEyePoint()) , 20);
            initialVelocity = %muzzleVelocity;            
            initialPosition  = %clientplayer.getWorldBoxCenter();
            sourceObject     = -1;
            sourceSlot       = -1;
      };
      MissionCleanup.add(%bullet);

Projectile Data Code
datablock ProjectileData(SampleSpellProjectile)
{
   projectileShapeName = "~/data/shapes/Projectiles/Projectile.dts";
   
   muzzleVelocity = 2;
   velInheritFactor = 0;
   armingDelay = 100;
   Explosion = SpellExplosion;
   particleEmitter = "ProjectileEmitter";
   lifetime = 10000;
   fadeDelay = 9000;
   isBallistic = false;
   bounceElasticity = 0;
   bounceFriction = 0;
   gravityMod = 0;
   hasLight = true;
   lightRadius = 3;
   lightColor = "0.8 0.8 1.0";
};
datablock ParticleEmitterData(ProjectileEmitter)
{
   ejectionPeriodMS = 20;
   periodVarianceMS = 5;
   ejectionVelocity = 0.25;
   velocityVariance = 0.10;
   thetaMin = 0.0;
   thetaMax = 180;
   particles = "ProjectileParticles";
};
datablock ParticleData(ProjectileParticles)
{
   textureName          = "~/data/shapes/particles/spark";
   dragCoeffiecient     = 0.0;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.00;
   lifetimeMS           = 350;
   lifetimeVarianceMS   = 50;
   useInvAlpha = false;
   spinRandomMin = -30.0;
   spinRandomMax = 30.0;

   colors[0]     = "1 0.7 0.7 1.0";
   colors[1]     = "1 0.7 0.7 1.0";
   colors[2]     = "1 0.7 0.7 0";

   sizes[0]      = 0.5;
   sizes[1]      = 0.7;
   sizes[2]      = 1.0;

   times[0]      = 0.0;
   times[1]      = 0.3;
   times[2]      = 1.0;
};