Author Topic: Glitched up stuck projectile that can kill people  (Read 507 times)

So whenever I throw this knife sometimes it sticks to an object at a certain angle. At this point you hear loud repeated sword hit audio files and anyone who touches the weapon on the ground gets damaged by it.

How can I fix this?

I want the projectile to stick to objects but I don't want this weird glitch to occur.

Code: [Select]
//Thrown projectile
datablock ProjectileData(BlackKnifeThrowProjectile)
{
   projectileShapeName = "./BlackKnifeProjectile.dts";
   directDamage        = 100;
   directDamageType  = $DamageType::BlackKnife;
   radiusDamageType  = $DamageType::BlackKnife;
   particleEmitter       = spearTrailEmitter;
   stickExplosion        = BlackKnifeExplosion;
   bloodExplosion        = BlackKnifeExplosion;
   explosion             = arrowExplosion;
   explodeOnPlayerImpact = true;
   explodeOnDeath        = true;  

   armingDelay         = 30000;
   lifetime            = 30000;
   fadeDelay           = 30000;

   isBallistic         = true;
   bounceAngle         = 170; //stick almost all the time
   minStickVelocity    = 10;
   bounceElasticity    = 0;
   bounceFriction      = 0;  
   gravityMod = 0.25;
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";


   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "0 0 0.5";

   muzzleVelocity      = 65;
   velInheritFactor    = 1;
   lightColor  = "0 0 0.5";

   uiName = "Black Knife Throw";
};

Code: [Select]
// Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = swordDrawSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "PreFire";
stateAllowImageChange[1]         = true;

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
stateSound[3]                   = BlackKnifeSwingSound;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";


stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";


};
« Last Edit: March 27, 2012, 09:41:04 PM by Lord Tony² »

I was able to fix this with -5 elasticity and 5 friction but now it says I can't do that anymore. I was able to do that before I changed the name.

I guess you didn't like my model :s

what about the projectile::onhitobject
or something, i'm not good with datablocks

The range of friction and elasticity is limited from 0 to 1. Friction controls how much momentum is lost with each bounce, and elasticity controls how high it bounces. I presume it is defaulting the values to 0 elasticity and 1 friction. The arrow uses an elasticity of 0.2 and a friction of 0.1, so try those values.