Thursday, 26 March 2009

Week 27: 23rd March - 29th March: Help

Over the last couple of days, I have had trouble with the programming of the project. There have been a number of problems encountered and so I decided to ask Dr Lucas for help. The first problem was with the collision detection. When the particle was falling and it hit the plane, it passed right through the plane. I had the collision detection set as checking whether the particle lay on the plane by putting the coordinates into the plane equation and if it equals zero then collision happens. However, as Dr Lucas pointed out, the particle moves under time and so moves under small increments of position and so it may not hit exactly on the plane. Therefore, I have to allow for some error below the plane. Another problem I had was that I was not sure whether the impact equation (ie. V = U - (1+E)(1-F)(U.uNormal)uNormal) was implemented correctly. I found out I was doing the cross product for U.uNormal instead of the dot product. I was also confused about the derivation of the angle at which the particle rebounded. I did not know whether this would be found simultaneously as the position and velocity or the rebound is found or whether it would need to be calculated with perhaps the equation a.b = abcos(angle). As I had not implemented the parabolic making equations yet, I was not to sure. Dr Lucas explained that the equations after the impact would describe the correct bounce of motion. After all this, I felt a lot better and I set off to fix the problems and implement the new equations.

No comments: