Jump to content

Redux, a global scene and scene recreation


promontis
 Share

Recommended Posts

1 hour ago, promontis said:

But like I said, I'm unsure on how animations fit in this.

I don't know if this is what you are asking, but here is a possible solution that works with redux-saga:
You send a command to BabylonJS from your saga as you do now, like ACTION_REQUEST.
Then in your saga wait on that command to "complete" in the saga with:

yield take(ACTION_REQUEST_COMPLETED);

In BabylonJS in the onAnimationEnd callback just use an action creator to trigger that:

scene.beginAnimation(this, 0, 30, false, 1, () => {
    // any additional logic and notify saga with this action
    onComplete();
});

Additionally, I ended up writing replayable scenarios that I test with BabylonJS running, so I run a series of commands and then assert the expected results.  It takes about 20 minutes to go through all the scenarios, but I use that as a sanity check.  The reason I mention that is that the animations and their chain of effects (butterfly effect!) can be tested in an automated/predictable way.  The physics engine plays an important role in my case, but sounds like you don't have to worry about that.

I ended up pushing most of my logic into the saga for many of the same reasons as you - moving the responsibilities around is a lot of work :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...