Melee Hit Trace Detection at lower FPS

Janluc123
Fri, 11 Jun 2021 01:31:59 +0000
Character & Animation

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.

4 posts - 4 participants