respondToCollision(o1, o2) {
        let dirTo = o1.dirTo(o2);
        let distance = o1.distanceTo(o2);
        let moveByAmount = 0.5 * Math.abs(distance);
        o1.moveBy(dirTo, -moveByAmount);
        o2.moveBy(dirTo, moveByAmount);

        // elastic collision
        let totalMass = o1.m + o2.m;
        let v1minusv2 = Vector3.sub(o1.v, o2.v);
        let v2minusv1 = Vector3.sub(o2.v, o1.v);
        let x1minusx2 = Vector3.sub(o1.x, o2.x);
        let x2minusx1 = Vector3.sub(o2.x, o1.x);
        let dSquared1 = x1minusx2.lengthSquared();
        let dSquared2 = x2minusx1.lengthSquared();
        let b1 = -2 * o2.m * Vector3.dot(v1minusv2, x1minusx2) / (totalMass * dSquared1);
        let b2 = -2 * o1.m * Vector3.dot(v2minusv1, x2minusx1) / (totalMass * dSquared2);
        o1.v.accum(x1minusx2, b1);
        o2.v.accum(x2minusx1, b2);
    }
/**
     * Handles the response to collision between object 1 and 2
     * @param {StateVector} o1 Object 1
     * @param {StateVector} o2 Object 2
     */
Handles the response to collision between object 1 and 2
@param {StateVector} o1 Object 1
@param {StateVector} o2 Object 2
Handles the response to collision between object 1 and 2 @param { StateVector } o1 Object 1 @param { StateVector } o2 Object 2
respondToCollision(o1, o2) {
        let dirTo = o1.dirTo(o2);
        let distance = o1.distanceTo(o2);
        let moveByAmount = 0.5 * Math.abs(distance);
        o1.moveBy(dirTo, -moveByAmount);
        o2.moveBy(dirTo, moveByAmount);
        let totalMass = o1.m + o2.m;
        let v1minusv2 = Vector3.sub(o1.v, o2.v);
        let v2minusv1 = Vector3.sub(o2.v, o1.v);
        let x1minusx2 = Vector3.sub(o1.x, o2.x);
        let x2minusx1 = Vector3.sub(o2.x, o1.x);
        let dSquared1 = x1minusx2.lengthSquared();
        let dSquared2 = x2minusx1.lengthSquared();
        let b1 = -2 * o2.m * Vector3.dot(v1minusv2, x1minusx2) / (totalMass * dSquared1);
        let b2 = -2 * o1.m * Vector3.dot(v2minusv1, x2minusx1) / (totalMass * dSquared2);
        o1.v.accum(x1minusx2, b1);
        o2.v.accum(x2minusx1, b2);
    }
respondToCollision ( o1 , o2 ) { let dirTo = o1 . dirTo ( o2 ) ; let distance = o1 . distanceTo ( o2 ) ; let moveByAmount = 0.5 * Math . abs ( distance ) ; o1 . moveBy ( dirTo , - moveByAmount ) ; o2 . moveBy ( dirTo , moveByAmount ) ; let totalMass = o1 . m + o2 . m ; let v1minusv2 = Vector3 . sub ( o1 . v , o2 . v ) ; let v2minusv1 = Vector3 . sub ( o2 . v , o1 . v ) ; let x1minusx2 = Vector3 . sub ( o1 . x , o2 . x ) ; let x2minusx1 = Vector3 . sub ( o2 . x , o1 . x ) ; let dSquared1 = x1minusx2 . lengthSquared ( ) ; let dSquared2 = x2minusx1 . lengthSquared ( ) ; let b1 = - 2 * o2 . m * Vector3 . dot ( v1minusv2 , x1minusx2 ) / ( totalMass * dSquared1 ) ; let b2 = - 2 * o1 . m * Vector3 . dot ( v2minusv1 , x2minusx1 ) / ( totalMass * dSquared2 ) ; o1 . v . accum ( x1minusx2 , b1 ) ; o2 . v . accum ( x2minusx1 , b2 ) ; }
Handles the response to collision between object 1 and 2
 @param {StateVector} o1 Object 1
 @param {StateVector} o2 Object 2
Handles the response to collision between object 1 and 2 @param { StateVector } o1 Object 1 @param { StateVector } o2 Object 2
// elastic collision