I'm building a game in c++ using Qt. I got the collision detection right using GraphicsItem methods the thing is that I don't know how to deal with every different collision type as there is different objects with different behaviour.
Asked
Active
Viewed 539 times
2 Answers
0
I guess that you are using one of the collidingItems or collidesWithItem methods. From these you get a list of QGraphicsItems. Then it is just a matter of casting to determine what hit what and reacting.
e8johan
- 2,899
- 17
- 20
0
It's actually possible to know which kind of object participate in the collision, through custom type, see the documentation for more info http://doc.qt.io/qt-5/qgraphicsitem.html#type
Christophe Weis
- 2,518
- 4
- 28
- 32
amirouche
- 7,682
- 6
- 40
- 94