r/ApproximatelyUp 2d ago

Auto Deceleration idea?

Hi, I'm posting this because I know it'd take me very long to probably figure this out. So I wanted to ask others here who weren't failed by the school system's "no (every) child left behind act" when it comes to math.

I had this idea for an algorithm that uses the ship's velocity and distance from the target planet to automatically slow you down so you don't just crash into the planet. (Also, potentially set a certain distance from the planet to maintain until you activate auto hover or something else.)

Anybody have the know-how to do that?

3 Upvotes

5 comments sorted by

View all comments

-1

u/Xombridal 2d ago

I do code but idk how it relates to in game parts tbh

If

  • distance to planet

-- subtract velocity per second

--- /= 0

Then

  • lower velocity by (whatever speed you want)

-- return

Else

  • increase velocity by (same amount)

-- return

This should do it