Author Topic: New angle of fire?  (Read 1526 times)

I've tried messing with joints, but they don't want to work. Is there any was I can just change the angle of fire in the script?

Such as..
Before:
Straight.
After:
45 Degrees.
« Last Edit: April 01, 2008, 06:05:16 PM by Azerath »

I didn't know fire had angels.

Osht. :cookieMonster: Thanks Ryk.
Know how to change its angle*?


So wait, what? Do you want to change the angle the bullet is fired at? i.e fired diagonally upwards/downwards from player, or something similar?

Yes. I'm already tried messing with the joints, too.

You can change the angle by changing the velocity of the bullet when it's fired. I don't know if there's a bit in the projectile datablock to tell it what angle to fire it at.

This should work:
Code: [Select]
%scalar = -1; // -1 is down 45 degrees, 1 is up 45 degrees.
%vec = %obj.getMuzzleVector(%slot);
%vec_x = firstWord(%vec);
%vec_y = getWord(%vec, 1);
%vec_z = (-%scalar) * (%vec_x + %vec_y);
%projectile.initialVelocity = (%vec_x SPC %vec_y SPC %vec_z);

Where %obj is the player shooting the projectile, %projectile is the projectile, and %slot is the slot where it is mounted.

Thank you. But where would I put this?

IIRC place it in the onFire function of your weapon.

Code: [Select]
function yourweaponImage::onFire(%this, %obj, %slot)
{
//blah
}