Thanks Rob:
I see where you were going with this though, but both methods are not 100% accurate in the rebound amount. I had considered "regressing" the ball back from it's collision point (diagonally) until there was no collision (I did this sort of thing in a platform game for a guy landing on/in a platform after falling). But basically it's still not accurate as there is no rebound. I have to know how much to rebound by and that is hard to work out on corners.
Thank for your suggestions though, they confirm a path I already considered unless I'm misunderstanding you.
Dreamora: OK, Scalar Product = Dot Product. I have made some vector classes and should be able to try this out. I'm still wondering what happens on corners... Anyway, I presume you mean a Right Hand surface normal?
Personally I would check collisions based on where the ball will be next cycle and therefore you don't need to worry about things getting stuck in walls.
This is what I'm doing. I'm modifying my BallX/Y coords just for the check, and then if it's not safe I'm changing them so that the ball is in an accurate rebounded position, so it's never stuck. check the collision for x+xs before you actually
move the ball... if there's no collision then do x=x+xs otherwise xs=-xs and don't move the ball
Yeah I tried that but it's basically inaccurate as the ball reverses course BEFORE it hits the wall. It's only accurate if the ballspeed is exactly double the distance from the wall. If it's close to the wall, it should be position further away after rebound, or if it's far away it should be positioned close to the wall after rebound. OR if I position the ball against the wall as you also suggest, a portion of the distance travelled has been lost because the ball should have bounced some distance from the wall. This brings me back to the way I was doing things.move the ball... if there's no collision then do x=x+xs otherwise xs=-xs and don't move the ball
I see where you were going with this though, but both methods are not 100% accurate in the rebound amount. I had considered "regressing" the ball back from it's collision point (diagonally) until there was no collision (I did this sort of thing in a platform game for a guy landing on/in a platform after falling). But basically it's still not accurate as there is no rebound. I have to know how much to rebound by and that is hard to work out on corners.
Thank for your suggestions though, they confirm a path I already considered unless I'm misunderstanding you.
Dreamora: OK, Scalar Product = Dot Product. I have made some vector classes and should be able to try this out. I'm still wondering what happens on corners... Anyway, I presume you mean a Right Hand surface normal?