Coder's Guild Mailing List

vectors

Posted by Fox on 2001-01-06

Happy New Year....big deal, it looks and feels just like the old year to me!  You 
call this the future??!!  hahaha

I know there has to be a way to represent velocity vectors on the computer.  I can 
figure out how to construct a vector from an (x,y) position, but getting them "tip to 
tail" so I can collide two objects I can't figure out.

I want to get two objects (one of them can be standing still, but usually both are 
in motion) to respond properly when they collide.  How can I represent their 
motions with vectors and get them to bounce off eachother so it looks correct?  
The objects have mass, BTW, and I think that is somewhere in the math...it 
wouldn't be a problem to include the masses of the objects.

But how do I represent vectors on the computer and add/subtract them to get a 
results of the collision of two vectors?  Both objects are going to bounce off 
eachother, how can this be done properly?  I'm not after 100% precision, but I at 
least want it to look right 98% of the time.

Perhaps directions to code already written, or a tutorial, or something like that?  
Thanks.