if one is (x1,y1,z1),another one is (x2,y2,z1). then the vector is (x2-x1,y2-y1,z2-z1).

Assume velocity of particle 1 is= (vx1,vy1,vz1),

The velocity component in the vector direction can be calculated as ,where is the length of velocity

i.e.

vx1'=((vx1*(x2-x1)+vy1*(y2-y1)+vz1*(z2-z1))/r^2) (x2-x1)

vy1'=((vx1*(x2-x1)+vy1*(y2-y1)+vz1*(z2-z1))/r^2) (y2-y1)

vz1'=((vx1*(x2-x1)+vy1*(y2-y1)+vz1*(z2-z1))/r^2) (z2-z1)

And the velocity compendicular to is

P.S. The inner product between and unit vector will give you magnitude of projection of vector in the direction of , so the component in the direction is