- Added an orientation variable to the Collision Volume class
- Allows for rotation of object’s collision voumes

- Set the inital rotational velocity to (0, 0, 0, 1)
- Which allows the object to be rotated

- Edited Gizmo code so that object roations can be seen.
- Edited the OBBClosestPoint function to the one found in Game Physics Cookbook page 181
- Sphere cube collisions now finding collisions
- not working when not hitintg the surface at 90 degrees

## 01/08/2017 – Oriented Bounding Box and Sphere Collision and Resolution

- Found fantastic resource:
- Refactored the OBB and sphree collision test
- Added variables to make the code easier to read
- Removed uncessary calculations
- used out variables from the OBBvsSphere test
- Added some Cubes to the scene to test OBB and Sphere collisions
- RESULTS:
- Sphree and cube collision only works when the contact is in the centre of the cubes faces
- If the cube has a rotation component
- It wont rotate properly until after a collision
- The rotation provided by the collision resolution is seen working

- RESULTS:

- Added the function OBBClosestPoint()
- Finds the closest point on the surface of the OBB to the target point
- Calculate the displacement between teh target point and the centre of the box
- Set the closest point to the centre of the box
- Project the target point onto each of the axes
- Clamp those values to within the confines of the box

- Finds the closest point on the surface of the OBB to the target point

## 31/07/2017 – Collision Detection Code Review, Rewriting and Testing

- Checked all member variables were in a consistent format
- memberVariable_

- Checked all parameter variabled were in a consistent format
- ParameterVariable

- Remove any unused functions
- thingss

- Changed the Axis Aligned Bounding Box (AABB) calculations to use Oriented Bounding Box (OBB) calculations
- CollisionInfo
- Added isResting_
- This lets us check if two objects are touching but the impulse generated is so low that neither object will move because of it

- Added a secondary constructor
- Takes two rigidbodies and two collision volumes

- Added isResting_
- Refactored the MeshVSMesh collision detection and resolution
- Refactored sphere to sphere collision response
- Removed sphere collision normal, point and penetration functions because they were calculating unnecessarily

- Refactored OBB to OBB collision response
- Moved the collating of the axes for the SAT calculations into a function
- static Vector3[] FetchOBBAxes(DyRigidBody BodyA, DyRigidBody BodyB)

- Created variables to go inot the OBBVSOBB calculation so that we can get the normal and penetration without unnecessary calculations
- Changed the parameters of the OBBVSOBB function to use these new variables as OUT variables
- similar to returned variables but used when we want to return more than one variable type

- Calculating the collision point is not straightforward
- Information found at:
- there are several different cases to check
- point to point
- point to edge
- point to plane
- edge to edge
- edge to plane
- plane to plane

- Moved the collating of the axes for the SAT calculations into a function

- Refactored sphere to sphere collision response
- Removed old inverse inertia tensor calculations
- Testing Sphere colisions results in
- The collision being checked multiple times
- Once from each side of the collision
- Produces a sticky effect
- Caused by each collision being resolved twice
- Resolved by scrapping the InVicinity check and checking each object against itself
- May revisit this if i have eough time as it makes using the physics in larger scenes with more object more efficient

- The collision being checked multiple times
- Moved the collision check itself inside the larger of the main object loops to save time and power

## 24/07/2017 – Code Review and Refactoring

- Refactor old code into the classes outlined previously
- Review and rewrite the way some code was written
- Pre-calculate the inertia tensor and its matrix
- Pre-calculate the inverse mass
- Pre-calculate the inverse inertia tensor matrix
- Rewritten to use the matrix of minors method
- Information found at:

www.cg.info.hiroshima-cu.ac.jp

- Information found at:

- Rewritten to use the matrix of minors method
- Collision response reworked
- Adding linear velocity to objects moved to inside the AddForceAtPoint() function
- Calculations rewritten to be easier to compare to equations
- Follow the impulse and rotation algorythm set out at: en.wikipedia.org/wiki/Collision_response
- “Compute the reaction impulse magnitude”
- “Compute the reaction impulse vector”
- “Compute new linear velocities”
- “Compute new angular velocities”

- “Compute the reaction impulse magnitude”

- RotationImpulse() parameters reduced to save transfering data twice

- Adding linear velocity to objects moved to inside the AddForceAtPoint() function
- Moved CalulateInvInertiaTensor() to the DyPhysics library
- Reworked so that it uses Dymath.InverseMat3()
- Finds the inverse of a 3*3 matrix

- Reworked so that it uses Dymath.InverseMat3()

- Reorganised the math library for easier readbility
- Begin Implementing Oriented Bounding Box and Oriented Bounding Box collision detection
- Separating axis theorem
- Information found at:
- Collate all the axes to check
- Information found at:

- Itterate over them
- For each corner in cube A and cube B
- Use the dot product to project the point onto teh axis we are checking
- If the distance returned is less that the current minimum distance then set the new distance as the minimum
- If the distance returned is greater than the current maximum distance then set teh new distance as the maximum

- Find the maximum length the two shaped together cover of the axis line
- Find out how much distance the shapes individually cover of the axis line
- Add the lengths of the two shapes together
- If the length of the shapes added together is less than the maximum length they cover
- The two objects are not overlapping along this axis

- If it is greater the objects are overlapping along this axis
- Find the penetration distance along this axis
- If it is smaller than the current smallest penetration distance
- Set it as the smallest penetration distance

- For each corner in cube A and cube B

- Separating axis theorem
- Created a setup function for the rigidbody class and shape specific ones for each subclass
- Rigidbody parent class
- Set the inita position
- Set the initial orientation
- Set the axes default vectors
- Set the inverse mass
- Shape specific setup
- Set the collision mesh’s dimensions
- For cubes its hte cubes width/height/depth
- For spheres its the radius

- Create the collision mesh
- Calculate the inertia tensor

- Set the collision mesh’s dimensions
- Use the calculated inertia tensor to create the inertia tensor matrix
- Calculate the inverse inertia tensor matrix

- Rigidbody parent class
- Created the Update algorithm
- Set the position
- Set the orientation
- Update the axes
- Update the shape itself
- Apply gravity if the object has Use Gravity set
- Update the position
- Update the orientation

- Apply the updated position
- Apply the updated orientation

- Created a very basic test environment in Unity
- Setup Function tested and working correctly

- Setup Function tested and working correctly

## Pre 24/07/2017 – Project Setup

- Created a project directory
- Created source code files
- Created a Unity3D project

- Build class diagrams for each the RigidBody class and the gameplay
- RigidBody
- Gameplay
- Create a maths library file to hold all the maths calculations. Such as;
- Finding the inverse of a matrix
- Converting a vector to a quaternion
- Multiplying a matrix by a vector

- Create a file to hold all of the physics functions. Such as;
- Add a force to an object a number of different ways
- Such as gravity

- Add a rotation to an object
- Resolve Collisions between two RigidBodies
- Calculate Inertia Tensors for objects

- Add a force to an object a number of different ways

- Create a maths library file to hold all the maths calculations. Such as;

- RigidBody