[Kde-games-devel] Review Request 128472: KBreakout: Fix Collision Detection

Julian Helfferich julian.helfferich at googlemail.com
Sun Jul 17 02:38:43 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128472/
-----------------------------------------------------------

Review request for KDE Games.


Bugs: 328812
    http://bugs.kde.org/show_bug.cgi?id=328812


Repository: kbreakout


Description
-------

Bug 328812 describes the situation where the ball reverses direction when hitting a block. This bug is very easy to reproduce in Level 11, where the ball is required to bounce through a narrow area.

The problem turned out to occur when the ball hits two bricks at once. The inteded way to handle this situation was:

1. Calculate the area of intersection of the ball with each of the two bricks.
2. Take the brick for which the intersection is larger.
3. The ball collides with this brick.

However, the function "collideWithTwoBricks" passed "ball" instead of "ballRect" to the function "intersectArea" which means that the calculated area was always NaN. Thus, the ball always collided with the second brick, even if the intersection area was tiny.

It is not too difficult to imagine this bug leading to a situation where the reversal of direction happens. I strongly assume that this patch also fixes bug 354517, and bug 328003 which are also caused by the ball not bouncing correctly off of two bricks. However, they are much more difficult to reproduce, so I am not sure.


Diffs
-----

  src/qml/logic.js 9dac82b 

Diff: https://git.reviewboard.kde.org/r/128472/diff/


Testing
-------

I activated the cheats and always skipped directly to Level 11.

* I confirmed that the reversal in direction takes place frequently in Level 11 before applying the fix.
* I confiremd that the reversal in direction no longer takes place after applying the fix.


Thanks,

Julian Helfferich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20160717/122976cc/attachment.html>


More information about the kde-games-devel mailing list