It is possible to filter objects with a function created in a behaviour?

I am tyring to filter objects in a condition that I have created in a behaviour (for exemple nearby objects)

Inside my condition (in the extention manager), when I check the result, only the correct number of objects have been picked up. But when I check in the scene eventsheet all scene objects are picked up. The condition did not filter the object.

Is it possible to do it ?


You actually figured that already out because:

So it is possible and the chances are that there are issues with your events. If you would post them someone may be able to point you in the right direction.

Eeerh… no, I don’t think I have figured it out :sweat_smile: . I’d rather thing that I havent explained my issue properly…

Here is a test function :

Here, I when used in an event sheet, I would like to only pick the “Targets” which are close enough from “Origin” (In the real project, I obviously wish to do more things… But the point here is to show that specific picking issue)

Here is how I use it in the scene event sheet :

And here is my debug output :

Result : That condition did not filter (or selectively pick up) the targets.

My question : How can I create a condition which selectively picks objects up, to later use them in the scene event sheet ?

The extention “Linked Object Tools” does that. But it is uses JS. It should probably be possible to do it with the event sheet only ?

Actually your function should work. I guess it is of the expressions you are using: in the function you display your target number with the PickedInstancesCount-expression, in the event you are using the SceneInstancesCount-expression which is not the same.

Woups… Indeed, I did not use the correct expression for the debugger. I have corrected it, and the problem still remains :

I believe functions are meant to be sort of self-contained. A work around and actually a longer lasting way would be to use an object boolean variable.

Set the object Boolean variable to false at the start of the function and then filter or pick certain ones and set their boolean value to true. Then back in the original area you can repick with a boolean is True condition.

Well, conditions do 2 things : send “false” when they are not met. And send “true” + pick objects up when they are met. That would be weird no to allow custom functions to do that…

Actually, the conditions “CanReachWithMaxWeight”, “CanReachWithMaxLength” and “CanReach” in the “Linked Objects Tools” do exactly the kind of object picking I am trying to achieve. So it is definitelly possible !

But these are written in JS. Maybe is not possible with the Extension Event Sheet. If so, I find it very odd… But, well, I’ll do without it.

EDIT : about the boolean + filtering. That would work, but it definitally is not what I’d wan’t to do in this specific case. The whole purpose of my extention is, for a large number of objects (let’s say 1000), to find which other is the closest. And I try to avoid avoid having each of my 1000 objects filtering 1000 objects.

I’ll have to look at that extension. Maybe it is a JavaScript technique.