Revision 1257072

Go back to digest for 9th October 2011

Bug Fixes in Games

Stefan Majewsky committed changes in /trunk/KDE/kdegames/kolf:

Fix some more Z-ordering bugs with static struts and b2ContactListener.

As described in bug 280943, the problem is that the old b2ContactFilter
implementation detected wall-ball collisions too early (when the AABBs
of the participating objects touched for the first time). Especially for
diagonal walls, the ball has not yet been strutted when ShouldCollide()
is called.

This problem is solved by switching from b2ContactFilter to
b2ContactListener, which kicks in only when a collision has really been
detected. (The contact is then disabled if appropriate, as recommended
by the Box2D manual.)

This solution unfortunately introduces a new problem: Walls around
RectangleItems are now invisible for balls coming from inside the
RectangleItem (e.g. bridges and windmills). Actually I have no idea why
this problem didn't appear previously. I solve this by introducing the
notion of "static struts": The rectangle item is the static strut for
its walls and raises them all, even if they are not colliding with the
rectangle item (WindmillGuard, you're an a**hole).


File Changes

Modified 5 files
  • /trunk/KDE/kdegames/kolf
  •   /canvasitem.cpp
  •   /canvasitem.h
  •   /game.cpp
  •   /obstacles.cpp
  •   /obstacles.h
5 files changed in total