### Summary

**Introduction**

For this assignment linear velocity, torque, and angular velocity have been implemented. A *RigidBody *class has been used to holds all the information about the body: Centre of mass, Velocity, Position, Rotation (or orientation), Angular Velocity, Force, Mass, Area and Inertial Tensor. Center of mass is calculated using the Paul Bourke’s formula to calculate a centroid of a 3D shell described by 3 vertex facets. You can find the full tutorial on his website here:

Each facet of a model (i.e. each triangle composing a mesh) is taken into account for calculating the c.o.m. Ai is twice the area of the i’th face and Ri is the average of the vertices of the i’th face. The Area of the whole mesh is calculated using Ai divided by 2 (the cross product is the area of the parallelogram, dividing by 2 gives the area of the triangle).

Each Rigid Body is contained in a *RigidBodyManager* which is responsible to update them all at each step. The video shows the unconstrained motion of a single cube. Linear and angular velocity have been implemented. Damping has been implemented using the following formula taken from Ian Millington’s book *Game Physics Engine Development*:

Drift correction has been handles using normalized quaternions for rotations. Inertial Tensors are calculated as follows: using a cube approximations and using an approximation obtained by integration as pointed out by Brian Mirtich in his thesis *Impulse-based dynamic simulation of rigid body systems*.