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

Forums

OverviewFelgo 3 Support (Qt 5) › Question about entityManager

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #13744

    Wilfred

    Hi Friends,

    I am new to coding so sorry if this is a super simple question. I am trying to remove only one entity when collision occurs. However I can’t seem to remove one without removing all of the same type.

    Ex:
    onCollidedWithBox:{
    entityManager.removeEntitiesByFilter([“box”]);
    }

    I know I can use entityManager.removeLastAddedEntity() but this will not work in my case because it may grab another entity that just spawned.

    Any help is appreciated, and again sorry for my noobness.
    Thanks

    #13745

    Alex
    Felgo Team

    Hi Wilfred,

    just call the removeEntity() function of the specific entitiy that you want to remove.

    Cheers,
    Alex

    #13746

    Günther
    Felgo Team

    Hi Wilfred!
    Don’t worry, everyone has to start somewhere 😉

    As an alternative to Alex’s suggestion, you can also use the EntityManager::removeEntityById function. Each entity has a unique entityId, which you can use to retrieve the entity object or remove the entity.

    Cheers,
    Günther

    • This reply was modified 7 years, 10 months ago by  GT.
    #13751

    Wilfred

    Thanks for the info guys! Will try this when i get home 🙂

    #13752

    Wilfred

    Hey Guys,

    I found success using the EntityManager::removeEntityById function. But I am having an issue where an entity of the same type will spawn before the first entity object is removed which causes the second entity object to have a different entityId. I am unsure how to retrieve this entityId or even set it. Therefore I cannot remove the second entity object because it is using a different entityId.

    I wish to keep the entity objects spawning one after the other before the first object collides and gets removed.

    Any suggestions on how to solve this?

    Thanks again,
    Wilfred

    #13776

    Lorenz
    #13861

    Wilfred

    Thanks for all the help guys I appreciate it. 🙂

    Cheers,
    Wilfred

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