Monday, 30 March 2009

Week 28: 30th March - 5th April: Meeting and Possible Solution to Problem

Over the weekend, I have had problems with the bounce of the particle working correctly. Sometimes it would work and other times it seems to fail and either not hit the plane and bounce anyway, go through the plane and then bounce or even collide with the plane and then just move to a completely new position entirely. I was a little stumped by this and so tried to work out what could be causing the problem. I tried bouncing the ball on a flat plane and it worked. I then moved the x coordinate of the particle keeping all other coordinates constant, and this was perfectly correct also. The same was done for the y coordinate. It was fine. Last but not least was the z coordinate and it surprisingly did not work. There was nothing obvious in the code that could be causing this so I decided to investigate further. I then tried the plane rotations individually with the particle in its original position. All but the x rotation worked this time. Considering that the y and z rotations worked fine, I decided to use them both together as I thought if they are both correct then the concatenation of both of them will be correct also. This was not the case. This left me completely confused so I left it alone until today as I had my meeting with Dr Lucas.
When this was explained to Dr Lucas, he was very confused also. He asked me about my collision detection and if I was using the absolute value which I thought I was but turns out I am not. I got him to explain in to me again and he went over a few other things that I needed to look at just in case they were causing the problem. Once I got a chance to look at the problem today, I did all of this although I did get very confused with the absolute value and how I could use that for the collision detection. I emailed Dr Lucas again and he made his way down to the labs to help. We worked out the collision detection but if failed to work in this new method. We spent a while looking over the code and he had to leave before the problem was fixed. He just left it to me to debug the program to see where it might be failing. While he was helping however, Dr Lucas stumbled across a umber of little mistakes in my code which I fixed but of course could not check as the particle was not colliding correctly. Therefore, I decided to revert back to the collision detection I had before Dr Lucas helped for the time being as it worked and change the small mistakes that he had found to see if it would make a difference to my original problem. It seems to work correctly this way and so I have decided that I will spend the rest of today and most of tomorrow to see if I can get the absolute value working in the collision detection and if not I think I will just stick to the collision detection I had originally.

No comments: