A simple approach to implementing this would be to detect collisions between a ball and a plane. Calculate the penetration depth, this is how far the ball flew past the plane and pushed the ball back in the plane direction.
This will lead to the position of the ball on the surface of the plane. If you do this for each frame, the ball will effectively glide across the plane, assuming, of course, that the ball's velocity vector is not parallel to the normal plane.
The collision detection field is large and complex, and depending on your game, you must determine what is sufficient for your requirements in terms of the required level of realism and performance requirements. You should always go for the simplest solution, which gives a fairly realistic feedback, depending on the game, which often does not have to be perfect.
Basically, you should break your collision detection into 2 phases, commonly called wide phase and narrow phase.
The wide phase can be as simple as performing a quick check of the bounding box to identify potential collisions, and then sending these potential collisions to a narrow collision detection to do more detailed checks where you determine if the collision really happened and the collision depth. If you have many objects, then the wide phase can use some kind of quadrant indexing to select only blocks near your object to perform collision detection.
Chris taylor
source share