I have a problem with a direction change

You’re making it very hard for yourself. If you make the balls physics assets, everything will happen automatically, ball bouncing, falling in pockets etc.