Once I was coding a pool game, and didn't know why the white ball kept on going on forever. It was 4AM, so I was already a little tired as you can imagine.

The glitch came from the fact that I had designed a whole polynomial function to imitate the deceleration of the ball... I replaced it with two lines: one creating speed and deceleration value, and another one subtracting the deceleration value until speed was zero. And then I went to sleep.

  • 2
    You mean you didn't want to try to calculate the friction coefficient and use that to cause the deceleration? Pssht what kind of dev are you?

  • 5
    @sylar182 I'm a dev, not a physics designer :(
  • 2
    @TheOct0 I would have solved this in the same manner. No need to make it super complicated unless you're aiming for real life physics.
  • 4
    I love physics, so I'd have gone with the equation.

    But a static drag coefficient is really easy and works well enough, too. (dxy *= friction every tick) I've used that pretty often as well
  • 5
    @Root I'm a simple man. I see that I have to integrate complicated physics into my game, I cry.
  • 3
    @Root that'd be version 4.0 or so. After I fixed all the other bugs I might loop back around and code some quality physics. (And add even more bugs)
Add Comment