# How to point the camera to a specific Mesh from a Group

**URL:** <https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147>\
**Category:** Questions\
**Tags:** camera-controls, animation\
**Created:** [July 15, 2020, 7:32pm UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147 "2020-07-15T19:32:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanchomogi](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@juanchomogi](https://discourse.threejs.org/u/juanchomogi)\
**Post date:** [July 15, 2020, 7:32pm UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/1 "2020-07-15T19:32:31Z")

</div>

Hello there.

I have this 3d model that is quite complex, it has several nested groups and I is kind of big so I want to be able to point the camera to an specific Mesh or Group, so I can show that specific part in more detail. My two main questions here are,

1. How to determine the target to point the camera? For this I was told to use Box3 but is not really accurate, I guess I’m doing something wrong because when I add a Box3Helper is not aligned with the mesh/group.
2. How to tell the PerspectiveCamera or the OrbitControls where to look at.

Some screenshots of the model:

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/3/32ca8497bc6cd5dddc1084408c10276f68551795.jpeg)  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/3/3cb8421ed008ece9eeb0ee3608aca22cb93ca994.jpeg)

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![Dragon3DGraff](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dragon3dgraff/32/10140_2.png) [@Dragon3DGraff](https://discourse.threejs.org/u/Dragon3DGraff)\
**Post date:** [July 16, 2020, 6:26am UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/2 "2020-07-16T06:26:33Z")

</div>

You can try this  
[https://threejs.org/docs/index.html#api/en/core/Object3D.lookAt](https://threejs.org/docs/index.html#api/en/core/Object3D.lookAt)

---

<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:** [July 16, 2020, 8:59am UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/3 "2020-07-16T08:59:29Z")

</div>

> [@juanchomogi](#):
>
> How to determine the target to point the camera?

If computing the bounding box does not provide the expected result, consider to just hard-code your focus points.

---

<div class="post-metadata">

**Author:** ![juanchomogi](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@juanchomogi](https://discourse.threejs.org/u/juanchomogi)\
**Post date:** [July 16, 2020, 2:26pm UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/4 "2020-07-16T14:26:08Z")

</div>

Is not a scalable solution. I must be doing something wrong, check this image, those are the boxes of the body and the neck.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/2X/0/0c27aaaedf1014ba605a2bf5287be257ef293f25.jpeg)

Why are they in a totally different position?

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [July 16, 2020, 2:29pm UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/5 "2020-07-16T14:29:29Z")

</div>

They seem to be correct. Are the boxes placed within the mesh (as children), or directly in your scene object? Do you use box3 calculation via geometry or `Box3.setFromObject()` ?

---

<div class="post-metadata">

**Author:** ![juanchomogi](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@juanchomogi](https://discourse.threejs.org/u/juanchomogi)\
**Post date:** [July 16, 2020, 2:34pm UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/6 "2020-07-16T14:34:38Z")

</div>

> Are the boxes placed within the mesh (as children), or directly in your scene object?

Directly to the scene, here’s the code I’m using

```
getObjectCenter(mesh, addHelper) {
      const { scene } = this.options;
      const box3 = new Box3().setFromObject(mesh);
      const position = new Vector3();
      box3.getCenter(position);

      if (addHelper) {
        const helper = new Box3Helper(box3, '#000000');
        scene.add(helper);
      }

      return position;
    }

```

---

<div class="post-metadata">

**Author:** ![juanchomogi](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@juanchomogi](https://discourse.threejs.org/u/juanchomogi)\
**Post date:** [July 16, 2020, 3:43pm UTC](https://discourse.threejs.org/t/how-to-point-the-camera-to-a-specific-mesh-from-a-group/17147/7 "2020-07-16T15:43:25Z")

</div>

Nevermind, I found out I was rotating the scene:  
`scene.rotation.y = Math.degToRad(rotation);`
