collision detection with vectors
it''s about the following tutorial, starting at "Bank Shot: Collision between two moving circles":
http://www.gamasutra.com/features/20020118/vandenhuevel_02.htm
"If they collide, divide the length of the shortened vector by the length of the one you originally passed into the function."
i don''t get this sentence. is "shortened vector" the vector you shortened (the movement vector from which you subtracted the movement vector of the other circle) or is it the new vector which resulted from the subtraction?
and what''s "the one you originally passed into the function" then? the new vector?
a summary just to see if i get the remaining right:
i have two movement vectors V1 and V2 of two objects. now i subtract V2 from V1 (V3 = V1 + (-V2)). i do the collision detection with V3. if it''s positiv i do the thing above which i don''t get (devide the length of two vectors) and i get a number between 0 and 1. this number i multiply with each of the original vectors V1 and V2 and get V1C and V2C, the shortened vectors which lead to the point of collision, right?
and is this also true if i don''t have cirles but only two points with vectors?
well, actually it''s not about circles but points. so i tried the following:
first i subract the movement vector of one point from the movement vector of the other and test both points for collision with the new vector. if they collide (along the new vector in this case) i determine the length til the collision along this vector. then i use this ratio to shorten the original movement vectors and get the exact point where they collide.
it works but isn''t there a more elegant solution for this?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement