Getting things moving

I’ve been watching some videos by Daniel Shiffman on vectors and forces and I think that would something that would be fun to experiment with after getting images back on the screen with the refactored code. I think with what I’ve learned so far I should be able to implement a very simple physics system that should be fun and educational to play with.

In order to accomplish this I think I’ll need the following:

  • A vector class to describe a 2D point
  • Methods to interact with the vectors (add, subtract, multiply, get/set magnitude, etc)
  • A way to draw primitives on the screen, or continue using textures
  • Optionally setup an event handler to make it interactive

One aspect I think would be particularly interesting is collision detection using position vectors and based on a radius for each object. I believe that if I take the position vector of two objects, subtract them to get the vector between them and then compare the magnitude of the resultant vector to their combined radii, I should be able to determine if they’re touching. I won’t know for sure until I give it a try, hopefully I’ll get a chance to get started on this soon!

Leave a Reply

Your email address will not be published.