Jump to content

How do I scale / rotate an imported mesh of many pieces? (with PG)


fateriddle
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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