rlewicki / MeleeTrace

Unreal Engine plugin that enables user to accurately trace melee hits in the game using interpolation between sockets defined directly on the character or weapon mesh.
https://www.unrealengine.com/marketplace/en-US/product/melee-trace
MIT License
40 stars 8 forks source link

Default Trace Density 5 is too low #6

Closed unreal79 closed 1 month ago

unreal79 commented 7 months ago

IMHO, default Trace Density 5 is too low. I just tested (thin cube 10 cm thick) and I didn't receive hit confirmation half of the times (even on 60 FPS). I believe setting Trace Density to 20 solves the problem even on 15 FPS -- no CPU load difference noticed.

rlewicki commented 7 months ago

Hey @unreal79, I appreciate the feedback however during my testing the current default of 5 seemed alright and I would rather keep the number lower than higher. However this make me realize that perhaps default value should be something that end user can configure in the project settings so it doesn't need to be changed in every single animation asset individually.

I'll mark this issue as feature request and will add this in the next plugin update.

Thank you!

unreal79 commented 7 months ago

I was clueless how MeleeTrace worked while writing about Trace Density 5. MeleeTrace.ShouldDrawDebug 1 made me change my mind.

There is no need to change default Trace Density, because actual hit detection depends on weapon length (distance between Start and End Sockets). The problem is that with long weapons and thin targets, the hit traces will not connect. Here is an example: 1

So, in order to guarantee the hit, Trace Density or Radios should be higher, like so: 2

Deciding right numbers could be done automatically, to cover the whole hit zone. I suggest rising Radius first (not exciding certain value) and then increase Trace Density.

I consider MeleeTrace.ShouldDrawDebug 1 command essential while designing a game.

rlewicki commented 7 months ago

Yes I do agree that this debug drawings are essential choosing the values that work for each animation and weapon. My ultimate goal was to make those debug drawings visible already in the animation preview however that is not really doable due to the fact that usually the tracing sockets are defined on the weapon mesh while the animation is defined on the character mesh. I wasn't able to figure out how to overcome this :(

travisbales2304 commented 5 months ago

I would also recommend to create a collision mesh specifically for the melee trace. Because as speed increased the physics check becomes less accurate.

rlewicki commented 5 months ago

Hi @travisbales2304, unless the socket travel speed is extremly high the trace detection should do just fine, it will lose some precision but because the system is sweeping between last known location and current location there is no risk of not detecting a hit.