So I have a firing projectile, it fires single individual rounds only when I press my LMB once, I want it to fire continous shots when my LMB (or keyboard key) is held down, how do I do that?
You have several option to do that…
1: Axis Bind : Input Action And Axis Mappings In UE4 - Unreal Engine
Axis bind continously gets called in every frame with input value… that means input value is 0 by when input is not pressed and goes to specified range (you can specify that in project settings / input).
For example if your axis bind configured as 0 - 1 and if you press mouse button input value would be 1…
So because of continously call you can check for that 1 and at that point you know mouse button is pressing…
However firing projectile i think you should have some delay between shoots… so
2: You can do a bool variable in your weapon or character class… when mouse button pressed you set that true.
Other mechanism should be done in TICK event, so you can check is button bool true or false and do your logic like add deltatimes or delayed triggered events etc…
this topics contains some tips about this: Mouse left button down to shoot automatically - Programming & Scripting - Unreal Engine Forums
Cheers
Indeed there are multiple ways to achieve this, see THIS thread.
It’s rather old, but I think you’ll find some ideas there that might match your existing setup & goal.
Also - note @anonymous_user_f5a50610’s comment about using Event Tick for this -
You’d probably be better off using a combination of a Gate and a certain Delay after each shot.
(And as a side-note - if you turn that Delay’s Duration into a variable, you’ll get a weapon/character with a dynamic rate of fire)
below is a basic script to get this working. basically you have a variable and set it to true when the button is pressed and false when released. then call the fire function. this function will keep firing until the variable becomes false.
Hello! I think in this video, Zak Parrish shows something very similar to what you want to achieve