Circle vs Edge collision detection / resolution
- by topheman
I made a javascript class Ball.js that handles physics interactions betweens balls as well as painting.
In the v1.0, the ball vs ball collision detection and resolution is well handled.
In the next version (v2), I'm trying to add edgeCollision handling. I'm having some problems, maybe you will be able to help me.
All the v2 branch source code is on github repository : https://github.com/topheman/Ball.js/tree/v2
The v2 demos (where you can see the bug I will be talking about) : http://labs.topheman.com/Ball-v2/#help
As you will see on the demo, I have two major problems that I'm having a really hard time to solve on Ball.js :
method resolveEdgeCollision : bounce angle is inconsistent
method checkEdgeCollision : if the ball's velocity (the length that it runs each frame) is higher than its diameter, eventually, it will pass through an edge, without triggering any collision
Any Ideas ?...