hmm.. I don't believe you are supposed to take the average of the velocities at all.
What I would do is use the Law of Conservation of Momentum and the Law of Conservation of Energy as follows:
Then you project comp and fvel back onto vx and vy, and ocomp and fovel onto ovx and ovy.
There's probably a better way to do the projections without having to solve for (o)comp, but its way too late/early right now to figure it out.
Hope this works.
As for rotational motion, if you use that equation, things work perfectly if you assume that the object will always be perfectly rotating. Thing is, when two spheres collide, their rotations would not be perfectly in conjunction with their movement. I'd know how to solve for this on a surface, but I'm not quite sure how that'd work in the air.
What I would do is use the Law of Conservation of Momentum and the Law of Conservation of Energy as follows:
Code:
//get projection onto vector between the two spheres
double vel = (dx*vx + dy*vy)/(Math.pow(dx,2)+Math.pow(dy,2));
double ovel = (dx*ovx + dy*ovy)/(Math.pow(dx,2)+Math.pow(dy,2));
//get projection onto vecto perpendicular to the spheres (other part of the velocity)
double comp = (dy*vx - dx*vy)/(Math.pow(dx,2)+Math.pow(dy,2));
double ocomp = (dy*ovx - dx*ovy)/(Math.pow(dx,2)+Math.pow(dy,2));
// using solved equations from momentum and KE
double fvel = ((m - om)/(m + om))*vel + ((2*om)/(m + om))*ovel;
double fovel = ((2*m)/(m + om))*vel + ((om - m)/(m + om))*ovel;Then you project comp and fvel back onto vx and vy, and ocomp and fovel onto ovx and ovy.
There's probably a better way to do the projections without having to solve for (o)comp, but its way too late/early right now to figure it out.
Hope this works.
As for rotational motion, if you use that equation, things work perfectly if you assume that the object will always be perfectly rotating. Thing is, when two spheres collide, their rotations would not be perfectly in conjunction with their movement. I'd know how to solve for this on a surface, but I'm not quite sure how that'd work in the air.

