I'm trying to create projectiles which bounce/ricochet off one another when they collide in mid-air.
All projectiles are spherical and have identical size, mass, and speed. Each has two vectors: one representing its current location and the other its direction and speed. (Vectors, here, basically being <x,y,z> tuples.) The distance/direction between the two projectiles can easily be calculated as a fifth vector.
In my head, I envision the ricochet as reflecting each projectile's velocity off of a plane perpendicular to the line between the two projectiles, but Googling for "vector reflection" and the like just gets me pages full of math I don't know how to translate into code. :-)
How can I model this collision? I'm not worried about real-world factors like drag, friction, or gravity — simple reflection is enough.
static void ricochet(Projectile projectile1, Projectile projectile2) {
Vector position1 = projectile1.position;
Vector position2 = projectile2.position;
Vector direction1 = projectile1.direction;
Vector direction2 = projectile2.direction;
Vector distance = new Vector(position1).subtract(position2);
Vector reflection1 = new Vector();
Vector reflection2 = new Vector();
// MAGIC!
projectile1.direction = reflection1;
projectile2.direction = reflection2;
}

