I am working on a breakout style game in Unity using c# and wanted to know what is the best way to increase the speed of the ball over time without changing the angle/direction the ball travels after colliding with the paddle, so I want the ball to travel in the same direction/angle (say 45 degrees).
To start with I am using the simple code below which is attached to a box collider on the left of the paddle to get the ball to move left as desired. This gets the angle right but I wanted to increase the speed over time but not sure how to.
void OnCollisionEnter2D(Collision2D col) {
if (col.gameObject.tag == "ball") {
col.gameObject.GetComponent<Rigidbody2D> ().velocity = new Vector2 (-10f, col.gameObject.transform.position.y);
}
}