I’m trying to do a line trace for my homing missile, which starts at itself and ends at the player, but it for some reason it can’t hit my player?
Your end location is the target mesh and then you set the target after the hit, is it even set in the first place?
Yeah it’s in my begin play. The engine would give me a reference error if it didn’t know what the “Player” is.
Run the debug and see where your line trace is going. This is the first step to narrowing this down. If you see the trace and it is passing through your target, then it’s a collision issue. If you don’t see a line trace from the debug, then “player” may not be instantiated properly. You don’t say whether this is passing as False in your branch printing “Hello” to the screen or if nothing’s happening at all. Either way, start with running the debug on the Line Trace.
EDIT: Keep in mind too that the “missile” has collisions as well which is most likely set to “Block” your “Visibility” channel. Running a trace using “Get World Location” will start from and go to the root (pivot point) of the object. So your missile trace starts at it’s pivot point and goes to the pivot point of your player. The pivot point is, generally speaking, near the center of the object. Running the trace from this location will cause the trace to collide with the first thing that blocks that channel, in this case your missile. I have ran into this problem even when ‘Ignore Self’ is ticked. I would suggest starting the trace a distance greater than the distance from your missiles pivot point to the end of the missile mesh/collision sphere or simply set your missile to “Ignore” the Visibility channel or you could set up your own custom collisions and use those instead of the defaults.
Make sure the collision on your player is set to block on the visibility channel. If you’re using a mesh to block it, then make sure the mesh you’re using has collision primitives generated (UE4 can do this automatically but you have to tell it to do it).
Alternatively just set the capsule collider on the player to block on the visibility channel, which is what I would do for things that dont matter aesthetically.