Resonite-Issues
Resonite-Issues copied to clipboard
Spatial Volume Aggregator
Is your feature request related to a problem? Please describe.
Right now spatial samplers can get a singular value from a spatial variable, however sometimes you then later want to aggregate multiple singular values within a region of space together.
Describe the solution you'd like
There should be a way to perform aggregation of singular values in space within a volume.
For example, if you have a sphere of some size, and a bunch of sampled point values in space, it would be nice to be able to sum all of the singular values together which are interior to the sphere.
Some common aggregation options could include:
- Sum
- Average
- Min
- Max
A common basic use case for this is from the perspective of some object, telling how many points are interior to the object, or even getting the average magnitude of some quantity from a bunch of individual points in space limited to a volume.
Describe alternatives you've considered
Right now you would have to perform this manually using active colliders and collision checks in Protoflux, which is somewhat cumbersome.
Additional Context
Following up from discussion here: https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/4199.
Requesters
LuxKitty Nytra
What exactly is your definition of "sum all of the singular values together which are interior to the sphere"? I don't really know what this means in this context.
Sphere has technically infinite number of points in its interior, meaning you would need a volume query, but like I explained in the other thread, that's not really technologically feasible.
The best you could really do is use some kind of sparse querying with the point samplers spaced in some kind of pattern.
The points would be specifically slots that have some single quantity attached to them at some exact point in space. So instead of sampling over entire volume, it would be checking which slots are interior to a volume and performing an aggregation on those values.
For example, I could say I want my spatial aggregator to sum over all of the points called Test which are floating point values on some slots in space, so whenever there are points interior to the volume which have that tag, you would perform summation on those only.
It could technically be thought of as the opposite of spatial variables where instead of a volume defining some spatial behavior that you're sampling from at points, you already have specific points in space defined and the volume performs some operation on those.
Counting is a simple use case for it, like I have 3 apples somewhere in the world, but how many are inside my basket (box volume)? Or some number of users are in the world with different attributes attached to them such as temperature, then ask within some region of space, what is the average temperature in that room (heat diffusion simulation). It's often common to reduce physical quantities to a point mass for simulation especially, so this would be useful for those types of situations.
I'm still kinda confused on how would this work. To me it sounds like you're asking for volume sampling, just... differently?
Hmm thinking about it some, we could potentially add a s system, where you specify a variable that's a reference to some list and then samplers which add themselves to that list.
That could potentially work? It'd sort of "reverse it" it in a way as you talked about. So the spatial variable is list and the samplers are just checking if there's list at particular point and then adding/removing themselves from list that we see.
This would also be very nice to have for a system I'm wanting to make to determine how many minecraft blocks of a type are in a region of space (cough cough chance cubes) so I'd very much appreciate being able to do it, because for a second today I thought I already could with spatial variables but it doesn't really work for that too well