Reputation: 147
I am experimenting with a 2D breakout game (in c#) using Unity 5 and wanted to know how I can change the direction of the ball based on which part of the paddle it made collision with.
For example if the ball touched the left part of the paddle then the ball should go left and if it struck the middle then it should go straight up and if it struck the right side then go right.
Upvotes: 0
Views: 370
Reputation: 26
You can make 4 different box colliders 2d on the every side of a paddle as a child object and add OnCollisionEnter2d() method to them where you can apply your mechanics
Upvotes: 1