-
Is there any way to obtain the length of the message list for MessageSpatial2D similar to MessageArray2D? For my use case, I have some matching between two agent types, and one of them needs to select from the other pool at random, so my workaround was to loop the I'm open to suggestions on alternative ways to achieve the same thing, though. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Not currently. Spatial messaging discretises the environment into a 1D array, however when accessing messages it returns messages from multiple bins (9 in 2D, 27 in 3D). It is worth noting that spatial messaging iterators do not perform a distance check, so the messages returned by the iterator will be a subset including all within the radius, but other messages outside that radius may be included too. (This is to avoid us double loading variables internally). So even if we did merely return the total size of the 9 (or 27) bins, the value could be higher than desired, Hence, from the limited information provided I expect your current approach is likely the best option. Make sure you are performing a distance check though. |
Beta Was this translation helpful? Give feedback.
Not currently.
Spatial messaging discretises the environment into a 1D array, however when accessing messages it returns messages from multiple bins (9 in 2D, 27 in 3D).
It is worth noting that spatial messaging iterators do not perform a distance check, so the messages returned by the iterator will be a subset including all within the radius, but other messages outside that radius may be included too. (This is to avoid us double loading variables internally).
So even if we did merely return the total size of the 9 (or 27) bins, the value could be higher than desired,
Hence, from the limited information provided I expect your current approach is likely the best option. Make sure you are p…