8:00 – 10:30 FP
- Working on collision detection. It just needs to be convex hull. At this point I’m thinking of doing the following:
- For each polygon
- calculate the shortest distance to the plane
- If the square of the distance is less than the collision radius
- See if the collision point is within the polygon (project the plane onto X, Y or Z, if it crosses an odd number of line segments, it’s outside – for convex polygons we can stop at one crossing)
- If the distance from the “center” (average of all points) to the collision point on the plane is less than the distance from the “center” to the test point, then the collision is happening outside the hull, and the force can be calculated based on the difference between the collision radius and the surface. Otherwise, it’s within the hull, and the force is based on the collision radius + the distance from the polygon.
- Well this is convenient – The Game Programming Wiki
- Looks like we can use Arvo’s algorithm. Going to see how this works. Discovered Arvo here at Gamasutra.
- Graphics Gems code repository
- www.geometrictools.com: source code for real-time computer graphics and physics, mathematics, geometry, numerical analysis, and image analysis
10:30 – 12:30 Interview
- Went well. The work would be entirely on site. Ah well.
1:30 – 5:00 – FP
- Got Arvo’s in. I can clean it up so that the collision test is only for solid shapes, which will allow me to get penetration values out of the collision. There was one tricky bit – I had to get the viewpoint matrix multiplies out of the collision calculations. So now there is a render() pass which draws, and a calculateCollisionPoints() that is called at some other time without any glBegin()/glEnd() blocks, and starting with an Identity matrix. I then pull the result of all the calculations off the matrix stack and save for the collision calculations. This does need to be cleaned up, but it’s not bad.