I read dozens of questions here about SO (and not only) about detecting arkanoid collisions, namely, the collision of moving circles with a rectangle of office supplies, but they all ask how to detect a collision or how to determine which side the rectangle hits the ball. My question is a little different - it is about calculating a new direction of speed in the case when the ball falls into the corner of the rectangle.
For simplicity, we assume that Vx >= 0and Vy <= 0, i.e. the ball goes from bottom left up and right, and also suppose that I know that it will hit the bottom of the rectangle. The green arrow indicates the approximate direction of the ball, and the blue dot indicates the first point on the line containing the bottom side of the rectangle the ball hits. If this point lies strictly at the bottom of the rectangle, then everything is trivial - just change Vyto -Vy. However, when this point lies behind the bottom side, this means that the first point of the rectangle on which the ball will touch will be its bottom left corner, in which case I do not think that the change Vyto is -Vycorrect. I think the new speed angle should depend on the distance of the blue dot to the corner. I also think that not onlyVy, but Vxmust also change (preserving, possibly, the length of the vector V).

So, how do we calculate new Vx and Vy when we get at an angle ? If you know good links that touch on this issue, I would be happy to know them. Also note that I'm more interested in the absolute physical model of this rather than the optimized approximation of simple to code. You can assume that there is no turning point. Thank you very much in advance
source
share