fateriddle Posted November 7, 2018 Share Posted November 7, 2018 So some assets I downloaded has a structure of __root__ ----> node-0, I can find that single child with id node-0, and perform rotation/scaling/isVisible to control the whole object. But some assets like in https://www.babylonjs-playground.com/#JUKXQD#52, has mutiple children meshes, then I don't know how to scale the whole thing, or make it invisible. Please help, many thanks! Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 7, 2018 Share Posted November 7, 2018 Hi. You are already doing this on line 22, where you apply scaling to the root. If you want to perform a transform to the whole object, then root object is the way. Quote Link to comment Share on other sites More sharing options...
fateriddle Posted November 7, 2018 Author Share Posted November 7, 2018 3 hours ago, MarianG said: Hi. You are already doing this on line 22, where you apply scaling to the root. If you want to perform a transform to the whole object, then root object is the way. Hey, thanks, scaling seems to work, but isVisible is not working on root. I'm trying to createInstance of it and set the original one invisible. btw, is .clone() simply creating a new mesh rather than creating an instance? So for performance wise, we should use createInstance() right? But then, createInstance won't copy children as explained here So the use case of createInstance is very limited? Because for any assets that consist of more than one child, you can't use createInstance? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 7, 2018 Share Posted November 7, 2018 isVisible only works for meshes and I suspect that your root is a transformNode. You can use setEnabled(false) for transform nodes Quote Link to comment Share on other sites More sharing options...
fateriddle Posted November 8, 2018 Author Share Posted November 8, 2018 9 hours ago, Deltakosh said: isVisible only works for meshes and I suspect that your root is a transformNode. You can use setEnabled(false) for transform nodes Thanks, I didn't notice the difference. Btw, the assets are all using a transformNode as the parent of all meshes (and it makes sense), if I createIntance of that node, it seems nothing will be copied. If I use .clone that node, things will be fine. But I have performance concern using clone instead of createInstance, should I be worried? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 8, 2018 Share Posted November 8, 2018 The best option would be to createInstance on all meshes and then parent these new instances to the root transformNode 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.