Jump to content

Alter sphere animation depending on live input data


Recommended Posts

Hi, I'm new to using Babylon and game development in general. I've been developing an animation of a sphere that gets bigger and smaller, and changes colour depending on the current value in a preset array in my code. However, I want to be able to read in live data, which would be a series of integers or floats, in order to change the values set in my animation keys as the scene runs. I am at a bit of a loss as to how to approach this, where would I start? Is it even possible?

Link to comment
Share on other sites

you could try, making something like,

Make two identical animations, use arrays to hold all the keys, then when you get that live data add it to the array of the extra animation then go to the current frame of the old animation in the new one.  Then make the original animation the extra one for the next time data is inputed.  This probably won't work very well if you have a lot of live data coming in a lot.

Just an idea.  :) 


Link to comment
Share on other sites

I have been wondering if scene.registerBeforeRender is what I needed. Here is my playground of what I've been doing so far:


I think I might have finally got it working using a preset array for now to simulate reading in live data, and I've used consecutive animations, and just updating the keys each time. I don't know if this is the best implementation however, or something hacky I put together. I also want to ensure that my animations are all in step with each other, I read something about deterministic lockstep in the documentation, is that what I would need to make sure this happens?

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.

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.


  • Recently Browsing   0 members

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