Snouto Posted January 4, 2018 Share Posted January 4, 2018 Hi New to babylon.js and I'm trying to set an visibility value to a mesh in my scene, such that I can animate the visibility to zero. The scene has been exported from Unity in to Babylon. The object in question is actually a typical Unity GameObject, whose child GameObjects all have Mesh Renderers and materials attached. So the main parent GameObject has nothing other than its inherent transform, and therein lies the problem: when in Babylon, this object has visibility:0 and no material object (in other words, it resembles the GO in Unity). What's kinda interesting/strange (to me) is that the parent GO in Babylon has visibility:0 already, yet I can see the child objects no problem. Thus changing the value of visibility of the parent GO in Babylon has no effect on the visibility of its children. I suspect this is more to do with Unity than Babylon, however. In Unity I have a similar problem if I try to animate the opacity of one of the GO's children. I think it comes down to the shader being used for the material - the one I have at the moment (Mobile/Diffuse) does not appear to present a parameter for colour and opacity, thus opacity can not be adjusted not even in Unity. For my own understanding, however, is there a way I can easily change the visibility/alpha/opacity of the parent object in Babylon that will also affect the child objects, or would I have to iterate through every child and animate their visibility values individually? Or is it really the case that I need to change how my Unity scene is constructed before Babylon an help at all? A visual of the object structure in Unity is here. Cheers Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 4, 2018 Share Posted January 4, 2018 Hello! all these 3 properties are not inherited so if you want to change them in a hierarchy you have to do it manually I plan to add a new parameter to the beginAnimation API to animate a property on an entire hierarchy: https://github.com/BabylonJS/Babylon.js/issues/3469 Quote Link to comment Share on other sites More sharing options...
Snouto Posted January 4, 2018 Author Share Posted January 4, 2018 Thanks @Deltakosh, it's as I thought. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 5, 2018 Share Posted January 5, 2018 You can now use the new APIs Snouto and Wingnut 1 1 Quote Link to comment Share on other sites More sharing options...
Snouto Posted January 6, 2018 Author Share Posted January 6, 2018 Fantastic, thank you! Which version of BJS is this effective from? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 8, 2018 Share Posted January 8, 2018 3.2 alpha 2: https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L2058 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.