How do I build and work with *sets* of objects?
I have several applications in mind that make me want a way to express something like, "From all objects matching _____ (a tag name, label name, presence in a trigger, etc.), select one or more of those objects by _____ (random choice, proximity, index, etc.), so I can manipulate its properties."
Right now, achieving this means that every object I want in that 'set' be explicitly wired to the logic doing the work. But if there are hundreds of such objects, it's prohibitively difficult to build those kinds of sets. I find that Dreams expects me to predict all the states an object might ever be in and encode those states into the object, then activate/deactivate them from remote. I run into trouble when I want other things in the scene to behave depending on the state of those objects.
I find myself wanting a way to do basic set logic:
* Define a set of objects matching some criteria
* Build a set manually by adding/removing elements
* Count the number of objects in a set
* Iterate over objects in a set, send signals to them, and get signals from them
* Perform set algebra: union, subtraction, intersection
Here're some use cases I've found are challenging to build:
"Present the player with a picker that lists all objects tagged 'furniture', but nothing else"
"When I click a button, I want my spotlight to randomly select one of any objects having an 'Actor' tag and look-at rotate to it."
"I want to emit a get well card in the direction of all actors tagged 'Sick'."
"When *any* tagged object that enters a Trigger Zone, I want to show text that says, 'Hello, {tag name}!'"
"I want my emitter to emit debris randomly selected from the set, 'All rocks that tagged 'debris' that are *not* tagged 'glowing'."
-
I had the idea for a "Set" gadget. Conceptually, it represents the results of a scene query.
It would have a few key features:
* A logical set can be connected to any 'object' port (the 'crosshair' port) found in in other gadgets.
* It offers tweaks (or a microchip-like design surface) that let you define some query criteria, e.g. "all objects with tag," "all objects with label", "all objects that are visible AND collidable".
* A logical set can be configured to "feed" its results to any object port(s) it's connected to, e.g. "In order," "Randomly," or according to some other logic.
Functionally, you could use Dreams' existing "Group" construct to help work with collections. For example, maybe the Set gadget is something you attach to a group that causes any gadget targeting that group to treat it as a set rather than a single object, sort of like how attaching a Microchip implicitly uses its target as the source for many of its operations while still letting the object be used normally.
Vous devez vous connecter pour laisser un commentaire.