George Fyles Portfolio....|

Contact:

Linkedin GitHub gffyles@gmail.com

This project was created as coursework for Advanced Higher Computing Science while I was 16-17 years old. I was still learning the basic concepts of OOP and had zero guidance on implementing something like this and as such, the implementation is poor - poor memory and object management, poor decoupling and encapsulation, not to mention inconsistent framerates across machines! I was still happy with the results however and I feel I have a deeper knowledge of the inner workings of complex physics systems than many of my peers.

The following text and tutorial was included in the submission of the project:

Physics Engine Project - Intro

This project uses a numerical method first developed in 1791 called Verlet integration, which is used to integrate Newton’s equations of motion to calculate trajectories of particles. It was first used in a video game by IO Interactive in Hitman: Codename 47, released on 19th November 2000. I myself have implemented the basic algorithm and further built upon it to make the simulation more precise/accurate.

It works by finding where a particle was in the last frame and how far it moved to get there. From this it works out the particles current velocity and then moves the particle accordingly. Once this is done, it again changes where the particle is by moving it down a bit for gravity, back the direction it came for air resistance based on the drag equation \(F_D=\frac{1}{2}\rho{v^2}C_DA\), and when on the floor, the particle is moved backwards to slow it down due to friction.

To keep a line between two points rigid, once both points have updated the distance between them is calculated. This distance is then compared with how far apart they should be and the points are moved towards each other until they are the correct distance apart.

Tutorials

Click below to see tutorials: