Imported files: taking objects out of __root__

Hello Everyone,

Physics on objects from imported files don’t seem to work when they have root as parent. I need to do mesh.setParent(null) on all objects which I want to have physics.

I am looking for a quicker way to just detach everything from root, but not detach other parent-child relationships.

Here is an example playground:

(The cube has children, which I want to maintain)

This is what I want to do:
image

Thanks!

Just replace “getChildMeshes” with “getChildren” and it should work. getChildren returns only direct child nodes of object, while getChildMeshes return all child nodes, no matter how nested they are.

4 Likes

Thank you! I don’t know why I couldn’t find that method name.