Can you start and turn of a trace on will or do you have to fire of several traces?

I’m trying to script in a major feature of our game, melee fighting. And if we could, we would want to stop the animation when it hits something, or to just simply use the trace to trigger the damage. So What I’ve seen so far in the trace nodes, they only fire once, and they trace only when you start it up. Not over a period of time which is what I want. The current solution is to trace every half second, and we could to every quarter of a second for more precision, but I don’t know how taxing that would be on the game.

Is there a way to hold a trace for a duration of time, say when you click the button until you get a contact. We have now two sockets, one for the tip of the blade, and one for the part where it meets the **** stock. And we trace between that.

Currently home so here is a rough sketch of the nodes:

We get the socket names, plug them into all the trace’s, and on mouse click we trigger several delays with different times. So it checks every so often, and returns true or false, and in the case of true, it stops the animation and blends back to the idle one. There has to be an easier way in blueprints to do this, cause this will get annoying when we will deal with combo’s and enemies as well.

For important things like melee it seems reasonable to trace every frame. Another option to tracing every frame is to attach simple shape components like boxes, sphere or capsules and look for overlap events from them.

Thanks man!

So here’s the result for now:

Ofc most stuff are placeholders.
We are planning on making combos with damage multipliers and different key combos as well probably, though for alpha we just want it to work.

Right now there is a tick event that is active all the time, but is locked by a gate that only opens when you click the button, and closes after a set time. There is probably a less taxing way of doing it or should I not worry?

That is really cool! Keep us updated with your progress!

For a better effect with a melee weapon i would recommend speeding up the animation a bit more.

Additionally, are you entirely sure a trace detection is the kind you are after?

The traces are okay and seem to be working, it just might be that in practice you may want the player to be able to hit a larger area so it feels better.
An alternative might be having a thin rectangular volume in front of the player that can be checked for collisions or overlap when appropriate.

Feel free to ignore me though, i recognize it is early days and there is time for all sorts of tweaks and things much later on down the line :stuck_out_tongue:

Hehe the anim is literally just worked on for 2 minutes C; I just want it to work before we do any major stuff on that. We will keep that in mind, we dont really know how it will be when we actually start fighting pawns, but we have enough time to take a 180 turn with most of our gameplay atm, cause we got nothing :stuck_out_tongue: