I have a Car1 traveling (not directly) towards another Car2, both cars can freely drive away from each other (making the velocity from Car1 to Car2 negative)

What I know of the cars is the velocity, location (Vectors) and their distance in a 3d space.

Both Cars are not traveling at a constant speed, nor in a fixed position (straight line), Car2 could stop. This would obviously result in Car1 approaching Car2 at the velocity of Car1.

What I'm having trouble figuring out is how fast is Car1 approaching Car2?

Would anyone have an ideas where to start, or some formula?

  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Commented Jan 24, 2022 at 1:38
  • $\begingroup$ This seems too general. Are there any restrictions on the curves defining the motions of the cars? $\endgroup$
    – John Douma
    Commented Jan 24, 2022 at 1:44
  • $\begingroup$ @JohnDouma I mean there are X, Y, Z. I'm just interested in the velocity of their approach. The speed at which they are approaching, or going apart. $\endgroup$
    – JareBear
    Commented Jan 24, 2022 at 1:49
  • $\begingroup$ Calculate their positions and velocities from a coordinate system centered at one of the cars. Then, whatever velocity you compute for the other car will be the relative velocity. $\endgroup$
    – John Douma
    Commented Jan 24, 2022 at 1:57
  • $\begingroup$ First calculate the velocities of the cars along the line joining them,after which use the concept of relative velocity. $\endgroup$
    – user1012971
    Commented Jan 24, 2022 at 3:29

1 Answer 1


I managed to figure this out in due time, I just had to calculate the relative velocity for Car1, by subtracting Car2's velocity from Car1's velocity and get the magnitude from that. I then got the distance from them and from a very small time interval I checked if they are going apart or not.

It's not a perfect system, and the formulas are not hard to figure out, I only have code snippets for it. But it works.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .