# AbstractMesh .getChildMeshes(false) && .getChildTransformNodes(false)

**URL:** <https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010>\
**Category:** Bugs\
**Tags:** blender, mesh, glb\
**Created:** [February 28, 2022, 3:28pm UTC](https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010 "2022-02-28T15:28:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jannick](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jannick/32/36560_2.png) [@Jannick](https://forum.babylonjs.com/u/Jannick)\
**Post date:** [February 28, 2022, 3:28pm UTC](https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010/1 "2022-02-28T15:28:37Z")

</div>

Hello again!  
I think I’ve stumpled upon a bug, or atleast an unexpected behaviour from the naming of a function.

After importing a .glb file (haven’t tested with other formats but I assume it’s the same since the functions are called on the AbstractMesh class), calling .getChildMeshes(false /_get all descendants_/) to get all the meshes in the glb file works as expected: I get all the meshes contained within the file.

However, then wanting to get all the nodes only, using .getChildTransformNodes(false), I both get all the nodes as TransformNodes, but I also in addition get all the meshes. Is this expected? If so, then the .getChildren(null, false) seems redundant or vice-versa.

Wish you a great day!

PG:

> **[Babylon.js Playground](https://playground.babylonjs.com/#WGZLGJ%234485)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![DarraghBurke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/darraghburke/32/10621_2.png) [@DarraghBurke](https://forum.babylonjs.com/u/DarraghBurke)\
**Post date:** [February 28, 2022, 6:01pm UTC](https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010/2 "2022-02-28T18:01:43Z")

</div>

Well, the `Mesh` class extends `AbstractMesh`, which extends `TransformNode`. So, meshes are themselves transform nodes. Getting both the meshes and the other nodes from `getChildTransformNodes` is the expected behavior. It’s a more inclusive function.

`getChildMeshes`, on the other hand, returns exclusively the children who are meshes, excluding all other transform nodes. So in this case, it only returns `PlaneMesh0` and `PlaneMesh`.

If you want to get only the non-mesh transform nodes, you could call:

````auto
getChildTransformNodes(false).filter(node => !(node instanceof BABYLON.AbstractMesh));```

````

This will filter the array, removing any node which is an instance of AbstractMesh.

---

<div class="post-metadata">

**Author:** ![Jannick](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jannick/32/36560_2.png) [@Jannick](https://forum.babylonjs.com/u/Jannick)\
**Post date:** [March 1, 2022, 7:53am UTC](https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010/3 "2022-03-01T07:53:23Z")

</div>

Thanks for the thorough explanation. It makes sense, I guess the wording just spawned some different assumptions in my brain. Although I fail so see the usage of the `.getChildren(null, false)` function then. Could you explain what the purpose of this method is in relation to the others?

And thanks for the code tip!

---

<div class="post-metadata">

**Author:** ![DarraghBurke](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/darraghburke/32/10621_2.png) [@DarraghBurke](https://forum.babylonjs.com/u/DarraghBurke)\
**Post date:** [March 1, 2022, 6:53pm UTC](https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010/4 "2022-03-01T18:53:25Z")

</div>

`getChildren()` will return all child nodes, regardless of whether or not they are `TransformNode`s. Not all nodes are transform nodes.

So to sum it up:

1. `getChildren` → all children
2. `getChildTransformNodes` → all children who are transform nodes
3. `getChildMeshes` → all children who are meshes

Each function returns an increasingly specific group.

---

<div class="post-metadata">

**Author:** ![Jannick](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jannick/32/36560_2.png) [@Jannick](https://forum.babylonjs.com/u/Jannick)\
**Post date:** [March 2, 2022, 7:36am UTC](https://forum.babylonjs.com/t/abstractmesh-getchildmeshes-false-getchildtransformnodes-false/28010/5 "2022-03-02T07:36:53Z")

</div>

Ah! Awesome. Thanks for the responses! They really helped out 😄
