Calculating Perpendicular Speed

81 Views Asked by At

This question is relating to a 2d game I am programming for.

There are 2 discs at positions (coordinates x & y): Disc1 is moving (at xspeed & yspeed) Disc2 is stationary

Knowing all the parameters, I need a formula that can calculate the perpendicular speed (in relation to the positions of the 2 discs).

I also need to know the x and y components of the perpendicular speed.

Refer to the diagram below:

Diagram

2

There are 2 best solutions below

0
On

It's just the projection of the velocity onto the perpendicular direction. You can find the angle between x-axis and the line connecting $(x_1,y_1),(x_2,y_2)$ and then just project xspeed and yspeed onto that direction, and sum them up.

0
On

Projection of $\vec A$ along $\vec B$ is given by $\frac {|\vec A . \vec B|}{|\vec B|} \vec B$ Subtract this from $\vec A$ to get projection of $\vec A$ perpendicular to $\vec B$