Hersir Posted May 2, 2017 Share Posted May 2, 2017 Hi ,is there some build in way to animate mesh and all its children together? Or I need to loop through all child meshes and apply animation separately? I have invisible mesh as container and I add children to it as I need group control. Works well for position changes but I need also to fade out children (opacity). Quote Link to comment Share on other sites More sharing options...
hunts Posted May 2, 2017 Share Posted May 2, 2017 Can you produce a pg? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 2, 2017 Share Posted May 2, 2017 I can. https://www.babylonjs-playground.com/#10KTHL#5 Lots to see, here. Apparently, groupmaster.clone and groupmaster.createInstance... don't "pass-along" animations to their clones and instances. Nobody asked about that, but I was curious. Box4 was changed to groupmaster, so that's why there is an odd numbering sequence. In lines 132-153, I "cloned" groupmaster.animations[0] onto all of its children. I had to do beginAnimation on each one. Then, in lines 157-159, I "negated" all the key.value's in box7.animations[0] (which is its cloned animation from groupmaster). Doing so... reversed ALL the animations, including the one on groupmaster (see console for dump). Interesting. Change a cloned animation, and clone-master and fellow clone-siblings change, too. All the cloned animations seem to be somewhat live-wired together. So, as far as I know (so far)... you will need to individually add animations to the children of the groupmaster. But, you know, animating the groupmaster... animates the entire group, as a whole. It is happening in this demo. The children are not doing the SAME animation as groupmaster is doing. They are only 'affected' (transformed) by groupmaster animation, via the parenting system. tip: Keep in mind that you can highlight large sections of code in playground editor, then enable/disable with control / . Handy here, and everywhere. Also notice line 12. Not sure why that .visibility setting is not working. Change to version 2.5, all is fine. Hope this helps. It is something to do testings-with, anyway. Party on. Hersir 1 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.