func Solve_Acceleration(start_acceleration , max_speed, old_speed, duration, delta):
var current_time = ...?
var new_time = (duration - current_time) + delta
var min_part = lerp(0, start_acceleration * duration, new_time)
var max_part = lerp(0, max_speed, new_time)
var new_speed = lerp(min_part, max_part, new_time)
return new_speed - old_speed
This is something like what I'm trying to accomplish, but I need to solve for current_time first. My understanding is that I need to do the inverse of what I've done here, but I don't know how. I'm not even sure whether this is a bilinear equation, or a quadratic equation.
I made an attempt at solving the problem as a quadratic equation but I got incorrect result:
var projection = start_acceleration * duration
var t = -projection - sqrt(pow(projection, 2) - (4 * speed * (max_speed - projection)))
t /= 2 * (max_speed - projection)