Mathematic formula needed for timer.
yuttuy3
Member, PRO Posts: 17
I'm not that great in math and am encountering some problems.
I'm in need of a formula to setup a timer to activate every 0.7 seconds, but the interval would get smaller and smaller, but will never be equal of smaller than 0 seconds.
Which (combination of) mathematic function(s) should I be using? and why would that be the best option?
Comments
Just made this up, I used timestamp to spawn an actor when the spawn time is greater than .02 seconds. After that it will spawn every .2 seconds.
Functions are all good depending on what you want.
If you want linear function you can use RabidParrot's method above (or the red function below).
If you want ease-in ease-out function you can combine it with cosine values (blue function below)
If you want a quick drop than slow down over time as it approaches zero you can use well I don't know what it's called (but it's the orange in below graph)...but here are 3 different functions that decrease over time and of course you can play around with the numbers to fit what you want at an online graphing calculator site like https://www.desmos.com/calculator
In the below graphs, x would be your time values, and y would be how long your interval time is.
graphs are fun.