fateriddle Posted October 16, 2018 Share Posted October 16, 2018 I notice we have a scene.registerBeforeRender(function() { }) function for inserting your animations. In a complex scene, where 1. everything start from a trigger action 2. they play in sequence, and the next one started when the first one play to a certain frame 3. more animations needs to be waiting for another trigger 4. some needs to play after assets loaded, and some assets will be loaded after trigger action should I be putting all the animation inside registerBeforeRender ? Is it even possible? I find my animation code everywhere, what is the best practice? Quote Link to comment Share on other sites More sharing options...
JohnK Posted October 16, 2018 Share Posted October 16, 2018 Hi @fateriddle and welcome from me. There are two main ways of achieving animation in BJS. One uses 9 hours ago, fateriddle said: scene.registerBeforeRender(function() { }) in this case you can change properties of BJS objects such as position, rotation etc. Another way is to use animatables https://doc.babylonjs.com/features/animations From your description it seems you are using animatables which do not go inside the registerBeforeRender loop. trevordev and fateriddle 2 Quote Link to comment Share on other sites More sharing options...
fateriddle Posted October 17, 2018 Author Share Posted October 17, 2018 Thanks, @JohnK btw, should I create all the mesh needed and set the unused ones to invisible till later, or should I create things out on the fly? How do I do it in later case? It seems to me that I can only animate properties, so I can't just meshBuilder a mesh at the end of an animation? Quote Link to comment Share on other sites More sharing options...
JohnK Posted October 17, 2018 Share Posted October 17, 2018 5 hours ago, fateriddle said: I can't just meshBuilder a mesh at the end of an animation? You could always use the onAnimationEnd parameter from scene.beginAnimation to create a mesh and start a new animation. When there are more than one way of doing something sometimes you just have to try them with a simplified example. I am not clear enough on what you are trying to achieve with your animation to have an opinion, sorry ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.