How would i go about making inputs start and stop more gradual?
Smooth exists, but thats not what i need.
I need to make the inputs gradually speed up on the start and end points, no matter where the input starts.
if 0>1 it will gradually speed up and slow down at 1
same with 0.2 >1 ,-900> 500, ETC no matter where it starts and stops, the acceleration should be smooth, so it looks like it has mass behind it. Alike to the ends of a sinus curve when it nears its endpoint.
How should I be able to do that?
@winterro yes, v is velocity and x is position, and both use the same coordinate system
Also, deltaTime doesn't exist in the game, you have to make it yourself
edit: I've seen this method used for gauges in an old train simulator, so here is an example gauge
@hpgbproductions @hpgbproductions Alright, this looks interesting.
The one thing i do not get is what. V and X exactly are, i assume V stands for speed and X for the positions, am i correct?
So, how i understand it
*setter* = velocity + deltaTime * (10*PositionTarget - Position) - 10*10)
10 are placeholders for Damper and Spring
simulate a mass-spring-damper system to be extra funky
.
constants: k (spring constant), c (damping constant)
deltaTime is the time difference between this frame and the previous frame, you can assume it to be 0.01 but this will make it act wrongly for low physics
.
SETTER v:
v + deltaTime * (k*(x_tgt - x) - c*v)
SETTER x:
x + deltaTime * v
I played with variables for such effect.
a
b
and
d
Where:
a - variable with an input of your choice
b - variable that does magik, it will approach target input (a) at the rate you set
c - sensitivity thing, when a and b get pretty close, rate at which b changes drops significantly, so c comes to counter that
d - the difference between a and b, can be set as
clamp01
if f is less than 1, anyways, just tune f, 0 and 100 to your liking (each must be greater than 0)f - can be just 1, another formula, simple modifier, its simillar to c
Pretty simple.
especially if you made it like, a year ago
0.5-cos(smooth(clamp01(Activate1),0.5)*180)*0.5
(smoothly go to "1" when you tap ag1, smoothly go back to "0" when you disabled ag1)
but i'm sure i am not right