Advertisement

Relative Velocity

Started by July 26, 2003 06:11 PM
1 comment, last by Endemoniada 21 years, 6 months ago
Hi guys, When I want to see if a moving circle collides with a stationary one the first thing I do is make a vector from the moving circle''s center to the stationary one''s center then dot it with the moving circle''s velocity vector to see if it''s heading that way, if it''s less than or equel to zero I exit the function with no collision. I learned that when I want to test if two moving circles collide I subtract circle 2''s velocity vector from circle 1''s velocity vector and treat it as a moving-stationary collision. But what about my early escape test ? Do I do the same thing using the new vector I made ? Or maybe I dot the original velocity vectors since now there are two moving objects. I''m confused. Thanks.
Basiclay, once you have subtracted circle 2''s velocity vector from circle one, you end up with the RELATIVE velocity of circle 1 RELATIVE to circle 2.
(Its the velocity you would measure if you were measuring 1''s velocity while standing at 2, i.e. you are effectivy stationary...)

As you now have a relative velocity, you do, as you say, have a situation where you can use a moving stationary colision test.

So basiclay: when you want to do a moving-moving collision test find out the relative velocity of one from the other and then use THAT vector (i.e. the one you worked out by subtracting 1''s velocity from 2''s velocity) in your original moving-stationary colision test function. (i.e. you perform your escape test on the relative velocity vector)

(sorry if thats a bit confused, just finished massive program debugging, and its now 1:30 am... more coffee n e 1?)


---------

Does it matter? Even if it does matter, does it matter that it matters?
---------Does it matter? Even if it does matter, does it matter that it matters?
Advertisement
You seem to be doing the right thing. By subtracting the velocity vector of circle 2 from the velocity vector of circle one, you are finding the relative velocity of circle 1 (relative to circle 2). Then you just treat circle 2 as if it were stationary when doing the early escape test, and do the test using the velocity of circle 1 relative to circle 2.

For example, if circle 1''s velocity was 100, and circle 2''s velocity was 90, then circle 1 is moving at a velocity of 10 relative to circle 2 (the displacement between them is increasing at 10 units per time interval). So if the displacement from circle 1 to circle 2 is negative (circle 1 is already in front of circle 2) then the early escape occurs. This example was in 1 dimension, it will work the same with vectors in more than 1 dimension. By dealing with the relative speed, you can treat circle 2 as if it were sitting still for all such purposes when doing the collision test.

This topic is closed to new replies.

Advertisement