Exemple #1
0
    void collisionResolutionBall(Ball A, Ball B)
    {
        Ball faster = A.getVelocity().magnitude > B.getVelocity().magnitude?A:B;
        Ball slower = A.getVelocity().magnitude > B.getVelocity().magnitude?B:A;

        Vector3 impulseVector = sheet.CalculateImpulseVectorBall(faster, slower);

        //Assumption, it's going to be applied as it is to the faster ball and with it's direction inverted for the slower or at rest ball
        faster.AddForce(impulseVector);
        slower.AddForce(-impulseVector);
    }