- Refined the friction calcs
- Added UI elements
- powerbar
- rotational
- changes colour as the power increases
- from green to yellow to red

- elevation indicator
- static image that rotates

- powerbar
- Solved the objects not rotating by finding their initialisation rotation and changing the last digit to a 1

# Month: September 2017

## 14/09/2017 – Final Gameplay and Testing

- Fixed the camera during the aiming phase
- Now rotates around the ball as the player changes the rotation

- Fixed the firing angle being negative when facing in the -z direction
- Used an absolute value of the ball’s forward vector rotated along the x axis by the elvation angle from the aimer

- Reworked the friction
- added a low velocity condition that stops the ball going on for ages with a very low velocity
- need to add a greater damping value
- so teh lower the velocity the faster it slows

- Reworked the camera positioning functions
- while in motion the camera will match the balls z position

## 13/09/2017 – Finishing Gameplay and rolling & Resting Contact

- Updated the final phase of the flow control to advance when the ball is still
- Added a catch for very small linear velocities in the rigidbody class
- Added a still threshold value
- IsStill function
- tests if we are not moving or rotating

- Added a catch for very small impulses
- Added an impulse threshold value

## 12/09/2017 – Gameplay and Camera

- Added more flow control for the game
- made it so that atatic objects do not collide with eachother
- Added a check for very low impulses
- makes the impulse 0 if its too low

- GAMEPLAY FEATURES
- fire the ball at the correct angle and elevation
- Camera follows ball wiht different parameters depending on the turn phase

## 11/09/2017 – Demo Environments

- Key levels to show of programming features
- ball vs ball
- Ball vs cube
- cube cube
- resting contact
- rolling contact
- friction

- gameplay features
- camera follows teh ball
- arrow keys to determine angle of fire
- space for power

- Demo Level
- Set up colours for the objects
- Green for the floor
- light grey for the ball
- red for obstacles

- Set up colours for the objects
- Updated the game files
- Collision checking moved to a function
- Added a Check inputs feature for when the game is in Aiming mode

## 07/09/2017 – Collision Corner Selection Code Review & Game Design

- Design
- Club
- At the start of each turn reset the clubs position to a set distance behind the ball
- Arrow for indicating direction
- Fire a projcetile that is destroyed on impact

- Ball
- End the turn when the ball reaches a standstill
- Ball has a trail that goes in teh reverse of the linear velocity
- when ball enters endzone go to next level

- Level Reset
- Reset button
- Out of bounds resets

- Camera
- Camera follows theball
- Follows at a 30 degree elevation in the direction of the reverse linear velocity?
- slerp or lerpfor smooth camera motion

- Levels
- Stacked cube pyramid
- Mountain
- Skijump
- Rotating tunnel made of cubes
- bouncing off surfaces
- space/no gravity
- pinball/angled plane

- Club
- Review
- Check every corner
- min and maxes are set
- those with comparable min maxes are chosen

- use compute span fucntion?
- friction rolling and resting contact

## 05/09/2017 – Implememnting Sutherland Hogman Clipping

- Implement a check to see if it is a single point hitting the face
- Implemented an IDX value to hold the endpoint of the line segment to be tested against the plane
- When j < clippedPoints.count – 1, IDX is j+1
- When j = Clippedpoints.count – 1, IDX is 0
- This is because we want a complete shape. This means we want to use the following pairs of vertex indexes on a quadrilateral incident face
- 0,1 – j, j+1
- 1,2 – j, j+1
- 2,3 – j, j+1
- 3,0 – j, 0

- Implement a line segment plane intersection
- Information found at: Christer_Ericson-Real-Time_Collision_Detection-EN.pdf Pages 175 – 176
- Where
- n is the plane normal
- p is a known poin on the plane
- A is the start of the line segment
- B is the end of the line segment
- d is the dot product of the normal and p

- Clipping algorithm implemented as below for each of the side faces of the reference plane
- Implement an averaging of the clipped points below he reference plane to give a single point
- Implement a function to provide the closest point on a plane to a known point
- TEST:
- face to face
- collision points is set as NaN

- edge to face
- Collision point it Nan

- point to face
- Seems to work but impulse is negative

- Problem area is likely in the selection of the corners in the collision

- face to face

## 04/09/2017 – Solving Sutherland Hodgman Clipping in 3 Dimensions

- Using the following algorithm
- Found at: Sutherland-Hogman Clipping Algorithm
- Create containers to hold the clipped points and a reference container for the plane points
- Create a container to hold the edge normals that run parallel to the planes
- Loop through the side planes and check each of the line segments in the incident plane against the edge normals
- If both ends of the line are positive then the whole segment is inside the plane save the end point
- If both are negative then the line segment is outside the plane save neither the start nor the end
- If start is positive and end is negative then the line segment intersects the plane save the point of intersection
- If the end is positive and the start is negative then save both the end and the point of intersection

- Use the clipped points to return a point that can be projected onto the face
- Use boht these points to find the point of intersection

## 30/08/2017 – Edge to Edge collision point

- Refactored the collating of the collision points into a function that usees two ot variables to hold the points
- Following the algorithm set out in Real Time Collision Detection by Christer Ericson (page 147)
- Get the start and end points of each line
- Based on the perpendiculary constraints substituting in V(s, t)
- Rearrange to solve for s and t
- Where;
- a = d1.d1
- b = d1.d2
- c = d1.r
- e = d2.d2
- f = d2.r

- Where;
- The results are as expected.
- they can look off when the cubde are not in rotations of 45 degrees as the corner selection algorithm guves back incorrect points in this situation