5
osmarks
8y

I was writing a simple algorithm to simulate gravity. But when I tested it it produced wildly wrong results. I looked over my whole algorithm trying to find the error, but thought that the last bit, the final position update, must be fine.
I was wrong, some misplaced brackets were accidentally multiplying the position + 0.5 by the sum of the old & new velocity instead of adding the position to 0.5 those velocities.

I noticed that and fixed it, and now it runs pretty well.

Comments
Add Comment