Forums

OverviewFelgo Installation › Detect when fixture is visible on screen

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #23657

    OCG

     

    I have created a box collider inside the scene as show below.  Using the RUBE example from the demos directory.  I have enabled the physics world debug and I can see that my collider is NOT centered in the screen, rather its top left corner is on the center for the level body.  As well, as the world scrolls left the collider is moving left with the world.

    How can I fix the anchors to the screen corners, and prevent the collider from moving with the camera view?

     

     

    GameWorld { …

    Scene { …

    // Collider to determine if body is visible onscreen
    BoxCollider {
    // Do not respond to forces, or collisions
    collisionTestingOnlyMode: true

    // make the same size as the screen (GameWindow)
    anchors.fill: parent
    fixture.onBeginContact: {
    var entityType = other.getBody().target.entityType;
    var entityID = other.getBody().target.entityId;
    console.log(“Begin collide with type “+entityType+” id “+entityID)
    }

    fixture.onEndContact: {
    var entityType = other.getBody().target.entityType;
    var entityID = other.getBody().target.entityId;
    console.log(“End collide with type “+entityType+” id “+entityID)
    }
    }

     

     

Viewing 1 post (of 1 total)

RSS feed for this thread

You must be logged in to reply to this topic.