OK thanks. Anyway this new method rebounding works nicely at any angle but it still doesn't solve my corner problem.
Even with the new method I still have to reposition the ball after the circle/line intersection test so that the ball is OUTSIDE of the wall by the correct amount as if it bounced and travelled the same distance in the timeslice.
So if (in the example in the picture) I take the collision point to be the right edge and use that to work out how much to move the ball outside of the wall, that's fine for vertical walls but on a corner it's not fine as per the bottom picture. This problem has NOTHING to do with the code used for the rebound ANGLE - that's all fine. The problem is to do with where to reposition it after the rebound.
Now taking into account what you have said about the ball's normal direction and if I know the collision point I wonder if something can be worked out. But my brain has faded again, I need food...
Even with the new method I still have to reposition the ball after the circle/line intersection test so that the ball is OUTSIDE of the wall by the correct amount as if it bounced and travelled the same distance in the timeslice.
So if (in the example in the picture) I take the collision point to be the right edge and use that to work out how much to move the ball outside of the wall, that's fine for vertical walls but on a corner it's not fine as per the bottom picture. This problem has NOTHING to do with the code used for the rebound ANGLE - that's all fine. The problem is to do with where to reposition it after the rebound.
Now taking into account what you have said about the ball's normal direction and if I know the collision point I wonder if something can be worked out. But my brain has faded again, I need food...