Let’s say we want to keep a ball perfectly in the centre of a table.
If it’s far away, we’re obviously going to want to push it towards the centre. The further away it is, the faster we want to push it towards the centre. So we apply a force **Proportional** to the distance from the centre.
This is cool, but what if there’s wind? Then we’ll be pushing against the wind, and our ball will end up slightly off centre because of that wind. We can look at how far off the centre we have been in the past, **Integrate** that distance from the centre over the entire past, then add a new force pushing based off of the integral. This lets us add a force to push against any constants like the wind.
Finally, we have one last issue. Pushing the ball towards the centre is good and all, but sometimes we’ll push the ball so hard that we overshoot, start pushing back, overshoot again, etc… You end up wiggling the ball back and forth instead of keeping it in the centre. We can add a new force to slow down the ball if it looks like it’ll overshoot, based off of the velocity, or the **Derivative** of the position to prevent overshooting.
This happens to be useful in a lot of different situations, not just for keeping balls centred.
Latest Answers