# Get object gltf

**URL:** <https://discourse.threejs.org/t/get-object-gltf/11491>\
**Category:** Questions\
**Tags:** object3d, models\
**Created:** [December 9, 2019, 2:15pm UTC](https://discourse.threejs.org/t/get-object-gltf/11491 "2019-12-09T14:15:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phenix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/phenix/32/8340_2.png) [@Phenix](https://discourse.threejs.org/u/Phenix)\
**Post date:** [December 9, 2019, 2:15pm UTC](https://discourse.threejs.org/t/get-object-gltf/11491/1 "2019-12-09T14:15:25Z")

</div>

I load three objects in a scene with a gltf loader (3 birds), when I try to get one of them (using the GetObjectById method(ByName doesen’t work)), I get one object that contains all those three birds.  
I tried to get a child from this object, but it doesn’t work.  
The question is-how can I get a separate model of one bird?

I need this to change their location in the update method (to do something similar to flying).

Code:  
const parrotPosition = new THREE.Vector3( 0, 0, 2.5 );  
loader.load( ‘models/Parrot.glb’, gltf =\> onLoad( gltf, parrotPosition ), onProgress, onError );

const flamingoPosition = new THREE.Vector3( 7.5, 0, -10 );  
loader.load( ‘models/Flamingo.glb’, gltf =\> onLoad( gltf, flamingoPosition ), onProgress, onError );

const storkPosition = new THREE.Vector3( 0, -2.5, -10 );  
loader2.load( ‘models/Stork.glb’, gltf =\> onLoad( gltf, storkPosition ), onProgress, onError );

---

<div class="post-metadata">

**Author:** ![Fluqz](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fluqz/32/6279_2.png) [@Fluqz](https://discourse.threejs.org/u/Fluqz)\
**Post date:** [December 9, 2019, 2:42pm UTC](https://discourse.threejs.org/t/get-object-gltf/11491/2 "2019-12-09T14:42:16Z")

</div>

```
import * as THREE from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';

// renderer
// camera
scene = new THREE.Scene();

gltfLoader = new GLTFLoader();
// Save your model reference in a variable
model = new THREE.Object3D();

gltfLoader.load('path/to/model', (gltf)=> {

        model = gltf.scene;
        model.name = 'model';

        // Add gltf model to scene
        scene.add(model);

        model.position.set(x, y, z);
    }, 
    onProgress,
    onError
);

// Or get your model obj from scene
model = scene.getObjectById(model.id)
model = scene.getObjectByName(model.name)
```

---

<div class="post-metadata">

**Author:** ![Phenix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/phenix/32/8340_2.png) [@Phenix](https://discourse.threejs.org/u/Phenix)\
**Post date:** [December 9, 2019, 9:44pm UTC](https://discourse.threejs.org/t/get-object-gltf/11491/3 "2019-12-09T21:44:16Z")

</div>

Thank you very much, it works.!!! You’re the best.!!!
