Test for number of objects in zone?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I am trying out the newer events with "compare to number of objects in a zone", however can I use these to somehow retrieve how many objects are in a zone? I can't seem to find this.

    Or do I just have to use the old way of using a foreach loop?

    Steam games: Please login to see this link.

  • No one has really answered your question, which is a good one.

    The function Fadzior suggests tells you how many objects were scoped by the conditions in the event, but it won't work with the compare to number of objects in a zone condition, because I don't believe that condition scopes the objects - it merely counts them.

    Though you could 'manually' test for the zone yourself, like this:

    Please login to see this picture.


    This is where you find that function:

    Please login to see this picture.


    But it begs the question: why test for objects in a zone manually using 4 separate conditions, if there already exists a single condition that can perform that test itself? But as far as I can tell, there's no existing condition that neatly tests for objects in a zone and scopes the resulting objects. That means that a forEach loop won't help you either.

    And while we have the compare to number of objects in a zone condition, we don't seem to have a corresponding expression that would directly provide you with the number.

    You can however use this condition together with a fast-loop, as below. This approach basically asks ''are there 0 objects in the zone? Is there 1 object in the zone? Are there 2 objects in the zone?....etc...' It's a bit of a roundabout way to do it, and possibly a bit expensive, but it works.

    Please login to see this picture.


    The simplest way is probably to combine an overlap check with the Number of selected objects expression, as below. It probably wouldn't be too expensive, especially as you'd be able to disable "use fine collisions" on the tester object since it'd just be a rectangle anyway.


    Please login to see this picture.

    Please login to see this picture.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!