Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › Fixture not working

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9115

    Bernd

    Hi!

    I am trying to use fixture: onBeginContact: {} to resolve collisions (collect power ups etc.)

    but I always get the message that “fixture doesn´t has members”.

     

    Since I get the same message while trying to run some of your demo games with the Qt Creator, I have no idea what the problem could be.

    #9116

    Christian
    Felgo Team

    Hi,

    can you post a sample code?

    Cheers, Chris

    #9117

    Bernd

    Sure, I am trying to do something like this:

     

        PowerUp{
            id: powerup
            x: 200
            y: 250
    
            BoxCollider {
              id:powerupCollider
              anchors.fill: powerup
              categories: Box.Category4
              collidesWith: Box.Category1
              collisionTestingOnlyMode: true
    
              fixture.onBeginContact: {
    
              }
            }
        }

     

    #9118

    Christian
    Felgo Team

    Can you post a test case with just a single QML file that works standalone please?

    Cheers, Chris

    #9119

    Bernd

    I hope that works for you:

     

    import Felgo 3.0
    import QtQuick 2.0
    
    GameWindow {
      id: gameWindow
    
        EntityManager {
            id: entityManager
            entityContainer: scene
        }
    
        PhysicsWorld {
          // set no gravity, the collider is not physics-based
        }
    
        Scene {
            id: scene
    
            EntityBase {
                entityId: "box1"
                entityType: "box"
    
                Image {
                    id: boxImage
                    source: "../assets/img/box.png"
                    width: 32
                    height: 32
                    anchors.fill: boxCollider
                }
    
                BoxCollider {
                    id: boxCollider
                    width: 32
                    height: 32
                    anchors.centerIn: parent
    
                    fixture.onBeginContact: {
                        // do stuff
                    }
                }
            }
        }
    }
    

     

    #9173

    Alex
    Felgo Team

    Hi,

    you can safely ignore that error message of the Qt Creator, it is just an issue with our auto completion files, it will still work when you run the code. This will be fixed with one of the next updates, thank you for reporting the issue.

    Cheers,
    Alex

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

RSS feed for this thread

You must be logged in to reply to this topic.