Download

Ray traces when I have a complex character parent class.

I am trying to figure out a way to make a system where I can map keys for things like selecting the nearest enemy. Selecting the Nearest friendly npc. This system is meant to work in a large open world. All characters in the game are derived from a single parent class called Character_Base.

So my thinking is that rather than attempt to do a line trace to every character in the entire world it would be best to have a radius around each character that I can then use to place all characters within the radius into a few different arrays that I can then check against for information I need like who in the list is the closest. So far this isn’t so bad but I have run into something else that makes this a bit more complicated.

Here you can see the radius I created.

I can then run a “get overlapping actors” and check what they are and place them in arrays. This check would be needed for me to see who is the nearest and make a keybind to select that target ect.

Ok so everything works but now the traces I need to check for if a target is in range or is visible from my character now fails because the trace hits the giant radius.

I am not sure how I can keep a giant radius like this without causing all of my traces to fail. Is there a way to make the trace only care about hitting the play mesh itself? It would be ideal if the traces ignored everything else in the world other than world static and the player model.

How would I set this up though? Or am I thinking about this properly?

I only had a minute to look at this but off the top of my head, I think you can pass specific actors to ignore into the trace. You could also change the collision responses of your “radius” so that it is ignored by the trace.

Capture.JPG&stc=1

Capture2.JPG&stc=1

I ended up having to do something different and it seems to be working now.

This specifically seeks out the capsule component of the character which seems to be working properly now.