foreach TraceActors: why won't it hit pawns?

  • 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.

SoSilencer

Harry Goz (1932 - 2003)
Nov 27, 2000
834
0
0
43
unrealdev.net
EndTraceLoc = 4096 * Normal(Vector(Pawn(Owner).ViewRotation));

foreach TraceActors(Class'Pawn', NewTarget, HitLocation, HitNormal, EndTraceLoc, Location, vect(256,256,256))
{
Log(NewTarget);


I'm tracing a line from me straight out 4096 units(I think), with an extent box of 256x256x256. Now I clearly have the class set to Pawn, indicating to me that it should only find pawns as that is how all the other foreach statements work. What I can't quite figure out is why in gods name is it hitting things other than pawns? Here is a snippet from the log showing what it is hitting.

ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.TFemale2Bot0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.Trigger3
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.Razor3
ScriptLog: CTF-Face.LevelInfo0
ScriptLog: CTF-Face.LevelInfo0

As you can see 99% of the time the trace is hitting the levelinfo(level? nothing?). It can also hit projectiles like razors and rockets. It somehow managed to hit a single bot, once, and it then did the proper code. I don't know why it's hitting all that other stuff though it should only hit bots. Does anyone know how I can set this up so it only counts hits against pawns (ie it ignores the level and projectiles and everything else and only collides with pawns)? That's all I need to do really. Send out a trace straight out and see which pawn it hits first, though it MUST be an extent trace and all the traces I've tried that have that option seem to hit EVERYTHING regardless of what settings you give it.
 

usaar33

Un1337
Mar 25, 2000
808
0
0
Unknown
www.UsAaR33.com
use a normal trace. If you hit a levelinfo (level), then that is that.
You can always go through stuff like projectiles (few would even be hit) and decorations by tracing again from their location+hitloc*2*collisionradius
 

SoSilencer

Harry Goz (1932 - 2003)
Nov 27, 2000
834
0
0
43
unrealdev.net
Normal traces don't have an extent variable though do they?

What I'm doing is making a new locking function for weapons that lockon like the rocket launcher. If I use a regular trace than you must keep the crosshair directly on the target for it to work, something that is basically impossible at 7500+ units (this code is for a weapon with a relatively long range). I could use angles like the UT lockon code does (at least I think it does) to create a targetting cone of sorts but in order for the cone to be small enough at max range the angle has to be very small meaning that at close/medium ranges you need your crosshair directly over the target.

From my understanding an extent trace makes something like a cylinder from me to the target, allowing just the right amount of "give" in the targetting to make it difficult but not impossible to target somebody at max range. Only problem is that rather than go through all pawns colliding with this cylinder it is stopping as soon as it hits any actor, including the level and projectiles. Somehow I need to fix this extent trace or come up with a new way to figure out what's in front of the player that works well at both ranges as short as 512 units and as long as 8192 units.
 

SoSilencer

Harry Goz (1932 - 2003)
Nov 27, 2000
834
0
0
43
unrealdev.net
Oh no I thought you meant TraceShot. I originally tried to use a normal trace but the problem with that nomatter where you aim the trace hits the ground you are standing on because of the extent box size. Just like TraceActors. I can't shrink that either because then you can't target long range players.

The whole reason I switched to TraceActors is that it is SUPPOSED to iterate through all the actors of a certain class it touches, yet it never does because it too hits the ground as soon as it is spawned. All I need to do is figure out what pawns are in front of the player, there must be a way to do this. It simply can't be this hard.
 

usaar33

Un1337
Mar 25, 2000
808
0
0
Unknown
www.UsAaR33.com
well, why trace?

You can just as easily interate through the pawn list
for (p=level.pawnlist;p!=none;p=p.nextpawn)

For each pawn do
fasttrace (p.location,owner.loctation)

That will tell you if level geometry blocks it or not.

From there you can do a dot product check between p.loc-owner.loc and normal(p.loc)-vector(pawn(owner).viewrotion