R-Tape wrote: ↑
Sun Jun 09, 2019 7:36 pm
Einar Saukas wrote: ↑
Sun Jun 09, 2019 2:38 am
The main reason it doesn't look right, is that the ball suddenly stopped moving forward while falling.
My picture is misleading—it allows horizontal movement during fall and I just stopped pressing the key.
To feel smooth, user input needs to control acceleration, not velocity or position (X in this case).
If each time you stop pressing the key, you stop any movement in X axis, it will not feel smooth.
NOTE: You also need some kind of attrition force, to make the object stop, after you stop accelerating.
I use a percentage of the - velocity or a fixed amount with opposite sign to velocity (abs equal or lower to actual velocity) so that when it reaches near zero, it will become zero).
In Steel Ball I implemented a 24 bit fixed value for X and 16 bit fixed value for Y, so that movement was smooth.
NOTE: Due to gameplay requirements, the ball needs to keep bouncing a minimum amount, so that the ball can move around in the scenery.
In this case, I hack the Y velocity abs value, if it's too low, after a collision with a flat/horizontal service.
You can try it online: http://torinak.com/qaop#48#l=https://sp ... mAFp9a.tap