View Full Version : the magical word "trace"

24th Mar 2004, 04:34 PM
again, my old problem is that i don't know how to draw the
trace and his effect from some location or a hitlocation.
I can do it easily from the weapon, but i wanted to make it from a class,
so i can use it any time i want from anywhere.
Let's make it from the "Effects" class example.
Now, the exact effect i want to do is:
1 my trace's start location is some other projectile's hitlocation
2 the direction is 3d random
3 must have a limited range (about 1,2 game meters)
4 draw it's effect (let it be the shockrifle effect for now)
5 does not have to hurt anybody or collode to anything, this will be just an effect.

i have tried to play with the "InstantFire" class, and i made this so far:
class TestEffect extends Effects;

var() class<ShockBeamEffect> BeamEffectClass;

simulated function PostBeginPlay()
local Vector StartTrace;
local Rotator Direction;

StartTrace = Location; // starting from a location
Direction = rotator( VRand() ); // direction is random 3d
MakeTheTrace(StartTrace, Direction);

function MakeTheTrace(Vector Start, Rotator Dir)
local Vector X, End, HitLocation, HitNormal;
local int ReflectNum;
local float TraceMaxRange;

TraceMaxRange = 1000; //want to have a range (does not matter now how many)

ReflectNum = 0;
X = Vector(Dir);
End = Start + TraceMaxRange * X;

HitLocation = End;
HitNormal = Vect(0,0,0);

MakeTheEffect(Start, Dir, HitLocation, HitNormal, ReflectNum);

function MakeTheEffect(Vector Start, Rotator Dir, Vector HitLocation, Vector HitNormal, int ReflectNum)
local ShockBeamEffect Beam;

Beam = Spawn(BeamEffectClass,,, Start, Dir);


the only thing that is working is the start location,
but the trace has no limit in range and the effect is pointing to some fixed point on the map, and some weird dino-face sprite is apearing allways at the start location....
as you can see, i realy need some help, so please correct my code i posted above. I think i'm not far from success but i just don't know what to do next.