1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Can anybody please explain trace() to me?

Discussion in 'Programming' started by RestInPieces, Nov 21, 2001.

  1. RestInPieces

    RestInPieces New Member

    Joined:
    Sep 20, 2001
    Messages:
    65
    Likes Received:
    0
    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.
     
  2. Shiit

    Shiit Shiit

    Joined:
    Dec 19, 2000
    Messages:
    168
    Likes Received:
    0
    native(277) final function Actor Trace
    (
    out vector HitLocation,
    out vector HitNormal,
    vector TraceEnd,
    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.
     
  3. RestInPieces

    RestInPieces New Member

    Joined:
    Sep 20, 2001
    Messages:
    65
    Likes Received:
    0
    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
    ^
    Surface

    thx, RiP
     
  4. Shiit

    Shiit Shiit

    Joined:
    Dec 19, 2000
    Messages:
    168
    Likes Received:
    0
    Yes, seen from the surface, it's straight up.
     
  5. RestInPieces

    RestInPieces New Member

    Joined:
    Sep 20, 2001
    Messages:
    65
    Likes Received:
    0
    Thanks.
    Does anybody know what the other vars are good for?
     
  6. Papapishu

    Papapishu 我是康

    Joined:
    Jun 18, 2001
    Messages:
    2,043
    Likes Received:
    0
    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...
     
  7. RestInPieces

    RestInPieces New Member

    Joined:
    Sep 20, 2001
    Messages:
    65
    Likes Received:
    0
    Thanks! I think Extent has something to do with some kind of "Colissionbox" that limits the trace's length... but I'm not sure :/
     

Share This Page