|21st Nov 2001, 11:58 AM||#1|
Can anybody please explain trace() to me?
Hi guys, i wanted to make a trace and didnt quite understand the trace (), can somebody explain the Vars and what they are good for to me? Especially HitNormal i don't understand, and where do i put the direction i want the trace to go? And if i dont pass a StartLoc, will this loc be the classowner's location? Please help me, thx, RiP.
|21st Nov 2001, 02:15 PM||#2|
Join Date: Dec. 19th, 2000
native(277) final function Actor Trace
out vector HitLocation,
out vector HitNormal,
optional vector TraceStart,
optional bool bTraceActors,
optional vector Extent
Hitlocation is the place of the first collision with either world geometry or an actor. If nothing was hit, it'll probably be the same as TraceEnd. (or not) Remember that "out" means that this variable not only goes IN, but comes out too (in this case, it only comes out, so you use an empty var for this, and that var will contain the hitlocation after Trace is done.)
HitNormal is a vector that'll contain the normal (the line that's 90 degrees on a surface) of the surface that the Trace line crosses first.
TraceEnd is the end of the Trace line. If something was hit, it'll never reach this point. For weapons, make this quite far away. Note that this is also where you specify the direction of the Trace. If you want to do the trace in direction X, this'll have to be "Location+vector(X)*1000" (supposed that the trace starts at "Location")
Since TraceStart is optional, I suppose it'll use the location of the actor Trace was called from. Just remember that the location of weapons is never used, so when you use it in a weapon you WILL have to specify this variable.
I don't know what the last vars mean, sorry.
|22nd Nov 2001, 08:20 AM||#3|
you said "the line that's 90 degrees on a surface".
What do you mean by that? the Angle beween the line and the surface is 90 degrees? like that:
|----------------------------- <- Normal
|22nd Nov 2001, 05:22 PM||#6|
Yeah, the HitLocation is quite usefull, yes?
Since it tells you where you have hit...
And the Traceend is good too, say if you wanna do a gun that has only a certain range, like the impacthammer...
Imagine if thatone had an infinite range...
Tracestart can be useful if you want the trace to start from somewhere else...
Like say your pawn has a weapon that's far away (not in the middle of the body) like on the head or feet.
Say a helmet with a laser-cannon or that he can kick someone, then you can use it to simulate a hit that comes from another angle...
The bTraceactors is a bool, so i guess that if you set it to true, it will skip any actor it comes across...
I'm not sure what extent means either...
|27th Nov 2001, 07:33 AM||#7|
Thanks! I think Extent has something to do with some kind of "Colissionbox" that limits the trace's length... but I'm not sure :/