Melee Hit Trace Detection at lower FPS

I currently have my Melee hit detection with 3 Scene components on the character and then having an Anim notify activating the Hitbox and taking the Scene components’ current locations and storing them. With the Hitbox activated, the traces occur on the Tick event with me using the Scene Components’ previous locations and tracing to the Scene Components’ current locations.

It works perfect at 30+ FPS, but when it goes any lower, the trace arc is significantly worsened and won’t trace the arc of the swing

Trace at 60FPS

Trace at 14FPS

[Video Link - Youtube][3]

As you can see, the arc of the swing is essentially nulled and it won’t hit anything that isn’t directly on top of the player.

I’ve noticed that the Animation speed has an influence, as the slower the animation, the less of an issue this becomes, but as I am working on a fast paced game I cannot afford to make the animations any slower.

Things I've tried:

  • Using Bone Sockets instead of Scene Components
  • Using Timers instead of Tick event
  • Generating the trace in UAnimNotifyState and running it on it’s Tick event
  • Turning on Substepping (Although admittedly I only turned it on in project setting and wouldn’t know what additional code I would need to use to make it work with animations)
  • Setting different Global Time Dilations depending on Framerate to slow down animations in order to give it time to trace the animation’s swing. This one gave me mixed results as having the Global Time Dilation set to < 0.7 would cause the formula I use to get the current frame rate ( 1 / Delta Seconds ) to get all wonky.

I’m getting kind of desperate and think I will just use a sort of “Back-up Hitbox” which would flash a large sphere trace in front of the player at the peak of the animation in case of the low frame rates and let my current set up do it’s thing if the game is running at a higher frame rate.

Any possible solutions/work-arounds that any of you have come up with in this situation? Thanks in advance.

1 Like

I have encountered similar issue.

The issue is that at lower framerates there are not enough point samples to represent the swing.

One approach would be to pre-generate a curve containing high frequency points of the swing. (This can be done offline in a custom editor utility for example).

Then, in each frame, you can use this curve to sample multiple points and issue multiple traces in a single frame. This will give you a closer approximation for the swing, even at low framerates. (Alternatively, you might be able to sample the existing animation curve directly and not need to create a separate offline curve)

BTW - Unrelated to issue but useful… Instead of a line trace you can use a shape sweep. Rama has a useful plugin on the store : RamaMelee

I’m facing similar issue. How will shape sweep work when there isn’t enough sampling points from animation due to low fps. It will be still wrong.

Hey Janluc, I am facing a similar issue and I was wondering if you managed to solve your problems.