# The mesh of GLTF model cannot be recongnized as type Mesh or Object3D

**URL:** <https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952>\
**Category:** Questions\
**Tags:** gltf\
**Created:** [January 9, 2020, 5:21am UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952 "2020-01-09T05:21:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakujitsu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/rakujitsu/32/8647_2.png) [@Rakujitsu](https://discourse.threejs.org/u/Rakujitsu)\
**Post date:** [January 9, 2020, 5:21am UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/1 "2020-01-09T05:21:59Z")

</div>

Hi everyone,

I need to load external GLTF models and unpack them to use their Mesh object in my scene. I use following code to unpack child:

```auto
      this.gltfLoader.load(url, (gltf) => {
        const model = gltf.scene.children[0];
        Object.defineProperty(res, 'entity', { value: model });
      });

```

But when I was about to remove them from scene and dispose their resources such as material or texture, I found its type is strange:

```auto
      gltf instanceof Object3D; // false
      gltf instanceof Mesh; // false
      gltf.isMesh; // true

```

I guess the gltf model should be an instance of Mesh, but it isn’t. Is this a bug?

PS: My model is created by Blender. [gltf-viewer.donmccurdy.com](http://gltf-viewer.donmccurdy.com) gives me following detail:

# Validation report

- **Format:** glTF 2.0
- **Generator:** Khronos glTF Blender I/O v0.9.36
- **Stats:**
  - 0 animations
  - 1 materials
  - 1 meshes
  - 1 nodes
  - 1 primitives
  - 1 textures

- **Extensions:** None

Report generated by [KhronosGroup/glTF-Validator](https://github.com/KhronosGroup/glTF-Validator/) 2.0.0-dev.2.7.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [January 9, 2020, 2:32pm UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/2 "2020-01-09T14:32:08Z")

</div>

Are you using `GLTFLoader` from the `three` npm package or from a different one?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 9, 2020, 4:49pm UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/3 "2020-01-09T16:49:00Z")

</div>

Currently it’s best practice to use `.isMesh` and similar properties to see what an object is. I don’t recall why that is, as opposed to using `instanceof`. There may be a few cases where the class hierarchy is non-obvious.

Butt as @Mugen87’s question suggests, it sounds like maybe there are two copies of three.js on your page? In that case comparing an instance from one copy to a constructor from the other will always fail. Always using the official `three` npm package and loaders/controls/subpackages from its `examples/*` folder should avoid that.

Aside: I wonder if we could ask the `three-gltf-loader` maintainer, and maintainers of similar packages, to mark them as deprecated (npm has a feature for this) now that threejs provides modules and typings?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [January 9, 2020, 5:27pm UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/4 "2020-01-09T17:27:13Z")

</div>

> [@donmccurdy](#):
>
> Aside: I wonder if we could ask the `three-gltf-loader` maintainer, and maintainers of similar packages, to mark them as deprecated (npm has a feature for this) now that threejs provides modules and typings?

I’ve actually had the same idea^^. Filed this issue some days ago. However, the package is still not deprecated ☹

> <https://github.com/johh/three-gltf-loader/issues/9>
>
> There are still too many user which include the \`npm\` package in their project i…nstead of using the \`GLTFLoader\` module from the official repository. This problem causes noticeable support efforts e.g.:
> 
> https://discourse.threejs.org/t/3d-model-from-blender-and-use-shape-keys/11851
> 
> Archiving the project and deprecate the npm package would help to mitigate this issue:
> 
> https://docs.npmjs.com/deprecating-and-undeprecating-packages-or-package-versions

Would be great if you could add a comment, too. Right now, `three-gltf-loader` has still approx. 4000 (!) downloads per week.

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 9, 2020, 7:03pm UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/5 "2020-01-09T19:03:58Z")

</div>

Thanks! Since the owner commented quite recently let’s give them a bit longer to respond…

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [January 10, 2020, 10:29am UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/6 "2020-01-10T10:29:46Z")

</div>

The package is now deprecated 🎉

> **[three-gltf-loader](https://www.npmjs.com/package/three-gltf-loader)**
>
> three.js GLTFLoader wrapped as a module for easy importing

---

<div class="post-metadata">

**Author:** ![titansoftime](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/titansoftime/32/1044_2.png) [@titansoftime](https://discourse.threejs.org/u/titansoftime)\
**Post date:** [January 10, 2020, 4:28pm UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/7 "2020-01-10T16:28:39Z")

</div>

> [@donmccurdy](#):
>
> Butt as @Mugen87’s question suggests,

Butt… lol.

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 10, 2020, 6:48pm UTC](https://discourse.threejs.org/t/the-mesh-of-gltf-model-cannot-be-recongnized-as-type-mesh-or-object3d/11952/8 "2020-01-10T18:48:08Z")

</div>

I’ll show myself out… 😅
