Girls, Guns, and CalcDrawOffset

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Silver_Ibex

Member
Feb 27, 2001
654
0
16
I have made a new weapon class to shoot projectiles; this new class has no first person information or model, totally 3rd person view only.

I use a sleep to calculate the rate of fire for each specific weapon since there are no first person view animations.

Everything is working great, just one problem, when I spawn shell casings they spawn at the player models exact center and drop to the ground.

I have been trying for the last four days to figure out how to get them to spawn like they do for the regular sniper rifle, even cut and pasted code from the rifle to see if that worked, but it didn’t.

It seems to have to do with the CalcDrawOffset function. What is the minimum I need to add to get this dam function to spawn them where I want them?

Or should I skip this altogether and use a new function to determine the spawn location???
 

TURY

SAS Lead Coder
Nov 4, 2001
17
0
0
Visit site
yes, calcdrawoffset()

ex:
var int A;

A=?

Spawn(ShellCase,, '', Owner.Location + CalcDrawOffset() + A * X + (2.8 * FireOffset.Y+5.0) * Y - Z * 1);

for example.

ps. thats looking really cool :)
 

Silver_Ibex

Member
Feb 27, 2001
654
0
16
This is what I am currently using to spawn the shells and a temporary light to simulate light from the muzzle flash.

///////////////////////////////////////////////////////////
Simulated Function WeaponFX()
{
local UT_shellcase s;
local Vector X,Y,Z;


if ( bEjectShell )

s = Spawn(class'ShellCaseType',, '', Owner.Location + CalcDrawOffset() + 30 * X + (2.8 * FireOffset.Y+5.0) * Y - Z * 1);
if ( s != None )
s.Eject(((FRand()*0.3+0.4)*X + (FRand()*0.2+0.2)*Y + (FRand()*0.3+1.0) * Z)*160);


if (bflash)
spawn(class'XYZ_WeaponLight', self, '', Owner.Location + CalcDrawOffset() + 30.0 * X,rot(0,0,0));

}

They should spray out sideways from the gun, instead they just spawn inside the character and drop, landing at the models feet.
 

EasyRaider

Crazy coder
Sep 21, 2001
74
0
0
43
Norway
I noticed you are not setting the vectors to anything. I believe you need a line something like:

GetAxes(Pawn(Owner).ViewRotation, X, Y, Z);

So CalcDrawOffset() isn't the problem.