void ballCollision() { // Balls can stick to each other as I haven't implemented to reset position by the overlap amount foreach (cueBall ball in balls) { // Skip if ball is itself if (ball == this) { continue; } if (VectorLibrary.circleCollision(position, ball.position, ballRadius)) { Vector3[] velocities = VectorLibrary.getCollidedVelocityBall(velocity, position, ball.velocity, ball.position, mass, ball.mass); // Assign new final velocities after collision this.velocity = velocities[0]; ball.velocity = velocities[1]; } } }