I am trying to code some swooping behavior for a flying enemy in my 2D platformer.
The ideal behavior has the enemy starting from an arbitrary height above the ground, then accelerating downward and horizontally until flush with the ground, after which he slows and comes to a rest.
I would like to code this in such a way that I can adjust a parameter controlling the steepness of the curve.
In other words, I want a kind of asymptotic movement, similar to this:
How can I code this kind of movement in such a way that my enemy can start from any height and smoothly and elegantly accelerates down this kind of curve before gracefully stopping?
I have recourse to all the usual stuff (for example, acceleration, velocity, friction, raycasts, etc.). I would prefer to code the movement using this stuff, rather than hardcoding movement along a curve or path.
I was thinking it might be possible to achieve what I want by raycasting downward and getting the enemy's distance from the ground, and using this distance to adjust accelerations and velocities, but I'm not exactly sure how to go about it.
I work in Godot, but would like an engine-neutral explanation of how to achieve this kind of behavior.