Maths with balls!

Following on from my experiments the other day with geometry-based collision detection I’ve been looking at good old vectors. I set myself two tasks

  • Work out how to reflect angles
  • Work out how to make a ball bounce off arbitary angled surfaces

It took a few hours of confusion, debugging and asking questions on the Internet and doing a bit of research but I’ve managed to create a nice little Processing applet that lets the user draw lines on the screen and have a ball bounce off them. To someone whos’ grasp of maths isn’t that great, it was fairly straight forward. Calculating 2D surface normals is surprisingly easy. Again I drew things on graph paper to help my understanding.

Click here to play with my balls!

About James

I'm just a person who likes writing software in their spare time. I'm not an "indie games developer" and am not trying to escape my day job and live in the happy world of games dev. I'm more like one of those people that used to write games in their spare time in the 80s. My stuff would be PD or Shareware if this were the 80s or 90s. It's good to comment on the posts in here :)