Hubs-Foundation / hubs

Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
https://hubsfoundation.org
Mozilla Public License 2.0
2.13k stars 1.41k forks source link

ForLoop flow node does not behave as expected. #6271

Open j-conrad opened 1 year ago

j-conrad commented 1 year ago

Description

When using a ForLoop flow node, the output doesn't appear to fire the correct number of times as specified in the startIndex/endIndex values of the node.

To Reproduce

Steps to reproduce the behavior:

  1. Open the included .blend
  2. Note the Behavior Graph setup.
  3. Export as .glb
  4. Run in Hubs and click on the icosphere
  5. Note that the debug message immediately says Completed Loop followed by 9.

Expected behavior

Based on the graph, upon clicking the icosphere, the debug should print 1 2 3 4 5 6 7 8 9 10 with a half second delay between each digit, followed by a debug message saying Completed Loop.

Screenshots image

Hardware

Additional context The example is the same setup as described by Unreal Engine's blueprint node, ForLoop. https://docs.unrealengine.com/4.26/Images/ProgrammingAndScripting/Blueprints/UserGuide/FlowControl/ForLoop_Network.webp ForLoop.zip

keianhzo commented 1 year ago

The problem here is that the way the delay node is design, it doesn't enqueue operations and if there is a pending operation it ignores the next one. As the for calls delay instantly for every number in the sequence, the delay node only executes the first one. for what I see the Unread node doesn't use delay so it's not exactly the same case.

What is the use case for this? maybe it's something that can be done it some other way?

j-conrad commented 11 months ago

In our meeting today, we discovered that using a Throttle node might be the solution to this issue, but we'll have to test it.