Page 1 of 1
Coding Question: firing thru walls
Posted: Fri Jun 04, 2004 4:13 am
by T-Bone7
I thought I'd ask the creators of the ERDW this: Is there a way that an instant-fire weapon can fire through walls, and if so, what is it?
If I wanted this for a projectile weapon, I woulda just copied code

(asking permission of course)
Anybody know?
Posted: Fri Jun 04, 2004 1:49 pm
by neolith
I am not a coder, but wouldn't an easy workaround be to make a really, really fast projectile?
Posted: Fri Jun 04, 2004 5:50 pm
by T-Bone7
Well, I thought about that, but I want instant. I thought I'd try that if I found out there was no easy way to do an instant fire.
Posted: Fri Jun 04, 2004 5:56 pm
by jeditobe1
You would have to make a trace that didnt detect bWorldGeometry (or whatever the setting is for walls/meshes)
Posted: Fri Jun 04, 2004 10:54 pm
by T-Bone7
Trace is a native function....
I'm looking at the instagib rifle code: if it hits a pawn, it inflicts damage and then starts another trace from there. I tried the same thing, if it hits worldgeometry, it traces from there. BUT, it doesn't do anything...
[edit]
Scratch that, it DOES go through walls, but only walls without thickness... ideas?
Code: Select all
function DoTrace(Vector Start, Rotator Dir)
{
local Vector X;
X = vector(Dir);
TracePart(Start,Start+X*TraceRange,X,Dir,Instigator);
}
function TracePart(Vector Start, Vector End, Vector X, Rotator Dir, Actor Ignored)
{
local Vector HitLocation, HitNormal;
local Actor Other;
Other = Ignored.Trace(HitLocation, HitNormal, End, Start, true);
if ( (Other != None) && (Other != Ignored) )
{
if ( !Other.bWorldGeometry )
{
Other.TakeDamage(DamageMax, Instigator, HitLocation, Momentum*X, DamageType);
HitNormal = Vect(0,0,0);
if ( (Pawn(Other) != None) && (HitLocation != Start) && AllowMultiHit() )
TracePart(HitLocation,End,X,Dir,Pawn(Other));
}
else
{
Instigator.ClientMessage("You hit WorldGeometry!");
if ( HitLocation != Start )
TracePart(HitLocation,End,X,Dir,Other);
}
}
else
{
HitLocation = End;
HitNormal = Vect(0,0,0);
}
SpawnBeamEffect(Start, Dir, HitLocation, HitNormal, 0);
}
[/edit]
[edit2]
Nevermind, I don't believe what I want is possible. Thanks for your help anyway... how fast can projectiles go?
[/edit2]