- Home /
Need help with easing effects which respect Time.deltaTime, MATH
Hi, I'm trying to implement some easing. Now that I'm developing in Unity, I want to use start-location independent eases like this which respect Time.deltaTime (the amount of time which has passed since the last frame). This is a Math question
So far, I've had success using (Time.deltaTime / 0.007f) to get an idea how many times slower the application is running compared to 144 HZ/FPS (1/144 = 0.007).
At 30 frames per second, (Time.deltaTime / 0.007f) ~= 4.8, meaning all my easing math can be scaled by this amount. This works in other locations, such as slowing objects down with ease consistently across all frame-rates:
physics.velocity *= Mathf.Pow( 0.8f, Time.deltaTime / 0.007f)
The above code works, but I can't figure out the next equation. I used to use code like this to ease a variable towards its target every frame.
X = X + (targetX - X) / 20;
I've tried taking some stabs at it, but I can't get Time.deltaTime factored into the above equation. Are there any gifted mathematicians who could help me, or shed light on ways to accomplish this more easily?