Gradually increase acceleration on key hold?
Hi, been working on a down slam ability that increases downward acceleration the longer you hold the key, currently it's set up with a timeline with manually placed keys which isn't scale able, is there something like the ^2 float node with more customization?
asked Nov 14 '18 at 07:07 PM in Blueprint Scripting
Why don't you just use the timeline or a timer with a separate variable to keep track of acceleration. Just have the timeline/timer add "X" amount to the start value until the key is released, once it is, stop the timer/timeline, use whatever value "acceleration" is at, and when finished reset the value to 0 and you will be ready for another attack.
answered Nov 14 '18 at 08:51 PM
Nebula Games Inc
You can set up a float variable (delta-accumulation) and start adding delta seconds to it when the button is pressed down, maybe add a upper limit value so that it does not rise infinitely. Then multiply this delta-accumulation to your base acceleration. You can have another co-efficient variable(which is just an arbitrary constant) to multiply to the delta accumulation and base acceleration. The co-efficient can be be used as a scaling factor for how you want the delta-accumulation to affect the base-acceleration.
final acceleration = base-acceleration x delta-accumulation x co-efficient
Note: Reset delta-accumulation to zero when the button is released
answered Nov 14 '18 at 10:47 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here