Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


OverviewFelgo 3 Support (Qt 5) › Troubleshooting BoxCollider collisions

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #12606



    I”m following the flappy bird tutorial at:



    I seem to be constantly getting the “stopGame” triggered, and i strong reason to suspect it is something to do with the some unexpected collision (i suspect between the pipes and the ground). Don’t think its the bird as i can’t even get to start the game before stopGame is called.

    My question is, how can i troubleshoot the collisions? Is there some way to output in the console which objects collided together?






    Hi Kevin,

    The Boxcollider has a Fixture property. The Fixture has an onBeginContact Signal

    You can do something like this to print the id of the entity you’re colliding with to the console:

    BoxCollider {
        fixture.onBeginContact: {
          // for access of the collided entity and the entityType and entityId:
          var body = other.getBody();
          var collidedEntity = body.target;

    Please let me know if that helps.


    Lorenz from Felgo





    Thanks for the quick response.



    • I put in some code in the Pipe’s fixture.onBeginContact() to only run stopGame() if the item collided with was the player… Is below a good way selectively process collisions? Reason I’m doing this is that the code provided by the tutorial runs stopGame whenever there is any kind of collision, and the lowerpipe is constantly colliding with the ground.
    if (collidedEntity.entityId == "player_0") {


    • Doing a console.debug(collidedEntity.entityId) as per your provided code, outputs an id value of “player_0” Why is this the case? Based on my code below I was half expecting the output to be “instanceofplayer”


    EntityBase {
        id: player
        entityType: "player"


    main.qml (inside the scene):

        Player {
            id: instanceofplayer
            x: 160
            y: 180
    •  Last question: how do i output the entity id of the object experiencing the collision (not the other object)


    Thanks so far! Quite helpful and happy with the quick response.






    Hi Kevin,

    As documented here, the entityid is generated by the EntityManager if you don’t set it explicitely. That explains the “player_0” id 🙂

    Using the entityid to distinguish between objects you are colliding with is perfectly fine as you proposed. However, I would recommend setting an explicit entityid!

    Alternatively, you can also use the entityType property.

    I hope I was able to clear things up a little. Feel free to ask if you have more questions 🙂

    Lorenz from Felgo




    Thanks Lorenz that helps. Still finding my way around the documentation. Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded