Game Development Community

Projectilespeed + runforce

by Dracola · in General Discussion · 02/01/2005 (5:16 pm) · 5 replies

I have had problems with a certain assasin playertype going faster then the projectiles he's shooting ( his top speed is 85 ) and running into them I need to something that would look like.

muzzleVelocity = 10 + currentspeed;

so it would add the speed he was going at to ten therefore he wouldn't crash into the projectiles. (and that's scientifically accurate) but "currentspeed" isn't a real variable and I can't find one like it that is.

#1
02/01/2005 (5:45 pm)
In fact, something like this is done in starter.fps. However, starter.fps uses a fraction of current speed rather than the full current speed. I think the relevant code is in crossbow.cs in the onFire function.
#2
02/01/2005 (5:57 pm)
// Determin initial projectile velocity based on the 
   // gun's muzzle point and the object's current velocity
   %muzzleVector = %obj.getMuzzleVector(%slot);
   %objectVelocity = %obj.getVelocity();
   %muzzleVelocity = VectorAdd(
      VectorScale(%muzzleVector, %projectile.muzzleVelocity),
      VectorScale(%objectVelocity, %projectile.velInheritFactor));

This would most likely solve your problem, make sure your projectile has a value called...

velInheritFactor = X;

And that it's set to at least 1.0 or above(experiment a little)


EDIT: DOH!!!! Eric got there before me, lol. Should have looked before I submitted.
#3
02/01/2005 (7:29 pm)
That's because you were more thorough. I just pointed in the right direction :)
#4
02/02/2005 (5:03 pm)
Darn I looked in all the hard places but not in the obvious. I had a suspicion it went a little faster when I was going full speed but it was difficult to test. thanks a lot ;).

yeah you probably saved me a little time by saying exactly where it was Gonzo

P.S. hows that pack coming I haven't heard of it in a while
#5
02/02/2005 (10:36 pm)
The pack is not dead. I have been contracting quite a bit lately and beyond that it's been a horrible year for all kinds of reasons. Seems like I take two steps forward and get knocked 20 steps back lol. But I am planning on finishing the pack ASAP. I'll see what i can do about posting a plan with an update.