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


OverviewFelgo 1 Support › How to check if there is an entity at position x y?

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



    how can I check if there is an entity at a certain position in the scene with the x y coordinates or the row and column of a grid?


    Felgo Team


    if your entities are having colliders, the easiest way would be:

    var selectedBody = physicsWorld.bodyAt(Qt.point(x, y));
    if(selectedBody) {
      // found something!
      var entity = selectedBody.parent.parent;

    The parent of the Box2D body that you select is the Collider, the parent of the Collider will be the entity whose properties and function are then accessible for you.






    Thank you!

    What if there are more entities at that point? Is there a way to get an array or a list of them all?

    Best regards,



    Felgo Team

    Hi Scarlet,

    bodyAt only returns the first object found. What is your use case for having multiple bodies at one position?

    Cheers, Chris



    I need it because the behaviour of the player character depends on the entities at some positions around it.



    Or is there a Way to get the status of the BoxCollider and the entity it is actually colliding with? I tried to use the BoxCollider, but to control of the player we use the joystick and if the user presses left again after the onContact while the player has still contact with the entity, the player character runs over the entity. So I tried the other way with checking the points, but that only works if the size of the entity is used and if I use the size of the BoxCollider I get the player entity and not the entity of the wall. So a list would be nice to check if there is any entity at that point which the player is not allowed to pass.

Viewing 6 posts - 1 through 6 (of 6 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