Line Trace Collision Randomly Stopped Working

Just about two hours ago, my player character’s sword hitbox that’s being line traced, just stopped wanting to generate a hit event on the enemy pawn. I’ve tried everything in my power to figure out what was wrong, but nothing’s worked. The weird part is that everything is exactly the same way I left it back when it was working.
If anybody has any ideas as to what is going wrong, or what I’m doing wrong, please let me know. **All help is greatly appreciated, sooner than later is preferred though!
**
Player’s Line Tracing + Object Type:

Enemy’s Character Mesh Collision Settings:

Enemy’s Capsule Collision Settings:

Any error message shown up in the editor after playing?

bIsTracing is actually true?

Does the trace returns a valid HitResult?

Can be a lot of things, but since you had it working before and suddenly its not, probably an error message would tell you if something is being accessed incorrectly.
Try debugging every step from the Raycast to when damage is processed

I don’t get an error message, and bIsTracing is true (only when AnimNotify BeginTrace is cued does it set it to true, and when AnimNotify EndTrace is cued, it sets bIsTracing to false, and those both work properly), but I don’t seem to be getting a valid HitResult when it collides with the enemy pawn, but I’m not sure why it isn’t. It’s tracing for pawn objects, and I have my enemy’s capsule collision set to pawn by default, it could be an issue with the enemy’s collision type but I’m not sure.

Try drawing the line trace, make the animation slower… print the Hit Actor…

Alright, it looks like it’s only line-tracing 1 point, where the sword starts the ark of the swing. Which again, is odd because it would line trace the beginning point of the ark, and the end point of the ark. Here’s what it looks like.

Is the “Box” attached to the Weapon Mesh?

Yeah it’s attached to the sword

If your Box is a Collision box, set “Hidden in Game” to false and “IsVisible” to true.

Check if it’s actually following the current weapon animation correctly

Are you sure the forward vector(X axis) for the box is aiming in the correct direction for the whole duration of the animation? Your raycasting code looks perfectly fine, so I don’t think it’s that. It could be is your boolean getting flipped on/off at the wrong times, but I don’t know how you are driving it. Maybe it’s bugging out when the animation is made to play again before it completed the previous loop and is breaking the variable. It could also be an issue in whatever code you have after the hit result. This is one of those test questions where the answer is “Not enough information.”

Try this: set the ray distance sort of short like 100 units and set it to fire on tick. Make sure that it’s flowing correctly; throughout the whole animation. If that’s working as intended, then pay attention to the hit actor; as GBR said. If the ray casting isn’t working, then analyze whatever logic you’re using to drive the boolean.

Alright, it looks like it’s following the animation perfectly, it stays attached to the sword where it was put throughout the entire animation

Alright I tried what you suggested, and I got this, so there’s definitely something wrong with the direction that it’s tracing, but I’m not sure how to fix it

Weird… Does at any point of your move the line trace changes rotation? (Posted it right after the image. Ignore)

Could you provide a more detailed approach of your code or a video? In order to avoid spamming the thread with ping-pong questions.

How is it attached on your Mesh, how the properties are set, for example.

found this thread that can be useful:

Alright here are some things that I thought might give more information on it.

Animation Notifies For Tracing:

Set bIsTracing on the Animation Graph From The Character Blueprints bIsTracing:

Hitbox Collision’s Collision Properties:

The Hitbox is Attached to the Sword Skeletal Mesh, which Is Attached to the weapon_rSocket

Video of Whats Going On In Game:

If you need more, just let me know since I wasn’t sure how much you wanted.

Last image is all I needed to see. Your X axis is pointing up (red is the X axis)

Alright I rotated it to the right direction with the x-axis facing left, but I still have another issue where it doesn’t seem to always actually hit the enemy, as demonstrated in the video below.

[video]https://youtu.be/HZgyV4utTC0[/video]

EDIT again: I see the red squares indicating that it is definitely hitting the mob.

Set up a debug print string and print out the hit actor to make sure.

Also, how are you actually trying to implement the hitscanning? Do you intentionally want it coming in perpendicularly with the blade like that, or do you want it running parallel with the blade and casting a few rays per swing? I never asked that and it makes a big difference in the x axis stuff that I mentioned earlier.

I’ve been wanting it to run parallel to the blade

Seems like you found out the first issue, now slow down your attack animation to visually guarantee it is hitting the actor and print it when is hit.

Also, seems like your active frames are ending too soon, maybe you can postpone a bit when your start your recovery frames

It’s definitely hitting it on some occasions, and is printing the hit actors name when it does hit, but I think the main issue now is the one IronicParadox pointed out. Where it’s hitscanning perpendicular to the sword’s blade, whereas I wanted it to be parallel to it. And I tried extending the time it has to trace into the recovery, and it didn’t have any effect.

When adjusting the rotation of a component attached to something and it includes animation, I usually add an arrow component attached to the point (your Box component), leave the animation playing in loop inside the blueprint editor Viewport and hit Simulation button. It will visually indicates you the forward direction of the component.

If you want to make a “Slash” trail simulation, I suggest you to have multiple* line traces every call. Tracing isn’t expensive, so no need to worry about performance in this case.

  • 1 parallel trace over the sword mesh and 2 or 3 perpendicular with given past end points that can be stored in an array, for example.