Legends Weapons
by Justin DuJardin · in Torque Game Engine · 04/01/2002 (1:36 pm) · 1 replies
Hey guys, I've got a question about weapon coding, i've run into some sort of bug or i've done the weapon script wrong. Here's my problem, i'm trying to duplicate the firing of a disc launcher for Legends but i'm getting a weird movement effect. I'll elaborate with this example scenario.
I'm in the air, strafing left and I fire! The disc then instead of going straight with a slight leftward angle, it seems to go to the left signifigantly, making aiming almost impossible. I'll include snippits of the weapon code below.
datablock ProjectileData(DiskProjectile) {
projectileShapeName = "~/data/shapes/disk/ammo.dts";
directDamage = 1.75;
radiusDamage = 1.25;
damageRadius = 10;
impulse = 1200;
explosion = DiskExplosion;
particleEmitter = DiskSmokeEmitter;
muzzleVelocity = 70;
velInheritFactor = .5;
armingDelay = 0;
lifetime = 15000;
fadeDelay = 1500;
isBallistic = false;
hasLight = false;
};
Any feedback as to what might be doing this is MUCH appreciated. :)
Justin 'av0n' DuJardin
I'm in the air, strafing left and I fire! The disc then instead of going straight with a slight leftward angle, it seems to go to the left signifigantly, making aiming almost impossible. I'll include snippits of the weapon code below.
datablock ProjectileData(DiskProjectile) {
projectileShapeName = "~/data/shapes/disk/ammo.dts";
directDamage = 1.75;
radiusDamage = 1.25;
damageRadius = 10;
impulse = 1200;
explosion = DiskExplosion;
particleEmitter = DiskSmokeEmitter;
muzzleVelocity = 70;
velInheritFactor = .5;
armingDelay = 0;
lifetime = 15000;
fadeDelay = 1500;
isBallistic = false;
hasLight = false;
};
Any feedback as to what might be doing this is MUCH appreciated. :)
Justin 'av0n' DuJardin
Torque 3D Owner Joel Baxter
Generally the value will be formed by adding the muzzle velocity vector (in the direction the weapon is pointing) to the player velocity vector scaled by velInheritFactor.
If that is the case, then if the muzzle vector points straight out from the player and the velInheritFactor were set to 1, then if you held down the strafe key, and fired, and continued to hold down the strafe key, the projectile would remain in the center of your screen. Since you have a velInheritFactor of 0.5, the projectile will not "keep up" with the center of your screen as you strafe, since it doesn't inherit all of your velocity vector.
If you think that the projectile's initialVelocity is being set incorrectly, then put some debug echo statements in there to print out the muzzle vector, muzzle velocity, player velocity vector, and anything else you think you might need to see to determine what is going on.