acceleratedChange in C SDK

Can we get acceleratedChange added to the C side of the SDK? It feels really good in lua games, kinda jealous. :slight_smile:

2 Likes

Looks like an accidental omission. I'll file it. Thanks!

5 Likes

I would love to have this in the C api too :slight_smile:

In the mean time, how is acceleratedChange calculated? Something related to the last crank change and to the elapsed time?

According to the source, acceleratedChange is the crank change multiplied by

1.0 / (0.2 + pow(1.04, -fabs(change) + 20.0))

3 Likes

Just for a little more explanation, it's a sigmoid function, similar to what is used for mouse acceleration curves.

In practice this means that the acceleratedChange value will be about the same as change at very low speeds, but then will increase more quickly than change as the crank speed increases, up to a maximum at which it will smoothly level off. (I think? it's been a while since I thought about this :sweat_smile: - @dave feel free to school me on the mathematics here.)

The idea is that it provides more natural motion for some uses of the crank - you can turn the crank slowly for precise control, but also more easily (as a player) do large crank moves without breaking your wrist.

1 Like

Thank you for the formula and for the explanation :playdate_heart_eyes:

1 Like