Implementation of physics model of smooth movement using acceleration, with an upper bound caused by air resistance.
-
$F_o$ is the output force, -
$F$ is the applied force, -
$F_f$ is the friction force, -
$F_{ar}$ is the additional resistance force.
The equation for acceleration output is:
which can be rewritten as:
Since
Thus giving the final form of equation.
where:
-
$a_o$ is the output acceleration, -
$a$ is the applied force acceleration, -
$\mu$ is a coefficient friction, -
$g$ is gravitational acceleration, -
$k$ is the modified air resistance constant, -
$v$ is velocity.
- Graphs showing the relationship between acceleration, velocity, and distance traveled,
- Pygame demo of movable object.
Use wsad
for movement, hold b
for faster movement (sprint).
Prefered python version Python 3.12.3 or newer.
Install required dependencies and libraries
pip install -r requirements.txt
To run the demo use
python3 main.py