# Simple Camera Focus

**URL:** <https://forum.babylonjs.com/t/simple-camera-focus/27433>\
**Category:** Questions\
**Tags:** documentation, camera\
**Created:** [February 7, 2022, 2:47pm UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433 "2022-02-07T14:47:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knifepro](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/knifepro/32/39429_2.png) [@Knifepro](https://forum.babylonjs.com/u/Knifepro)\
**Post date:** [February 7, 2022, 2:47pm UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/1 "2022-02-07T14:47:12Z")

</div>

Hi ı have a problem anybody help me?

I WANT TO FOCUS THE CAMERA ON THE OBJECT I CHOOSE BUT I CAN’T

focuschange forced to work but statechange is null //returns this value//

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [February 7, 2022, 3:44pm UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/2 "2022-02-07T15:44:23Z")

</div>

Hi!

YOU CAN FOR EXAMPLE USE THE `camera.setTarget(Vector3)` FUNCTION TO FOCUS THE CAMERA ON A GIVEN 3D Vector or the `lockedTarget` property of a `TargetCamera` which you can use to focus at a mesh or position.

For more information please have a look at the documentation:

> **[Cameras | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/cameras)**
>
> Learn all about the different types of cameras available in Babylon.js.

> **[TargetCamera | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/classes/babylon.targetcamera)**
>
> A target camera takes a mesh or position as a target and continues to look at it while it moves.This is the base of the follow, arc rotate came \[API\]

🖖

---

<div class="post-metadata">

**Author:** ![Knifepro](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/knifepro/32/39429_2.png) [@Knifepro](https://forum.babylonjs.com/u/Knifepro)\
**Post date:** [February 8, 2022, 6:37am UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/3 "2022-02-08T06:37:50Z")

</div>

thanks for your feedback but  
ı can use function the other component like this  
onClick={() =\> focusChangeCamera(meshName, scene, boothName)}  
but i can’t use it here

mesh.actionManager.registerAction(

```
    new ExecuteCodeAction(ActionManager.OnPickTrigger, () => {

      focusChangeCamera(mesh, StateScene, gltfName);

    })

  );

```

I made the variable names specific to that field, and it doesn’t work when I make the variable names as above.

When I click on the object I want to focus on, it leaves the free camera and switches to the arcrotate camera.but definitely not able to animate

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [February 9, 2022, 10:48am UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/4 "2022-02-09T10:48:19Z")

</div>

Could you kindly provide a repro with your problem in PG?  
It would be much easier to help.

---

<div class="post-metadata">

**Author:** ![Knifepro](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/knifepro/32/39429_2.png) [@Knifepro](https://forum.babylonjs.com/u/Knifepro)\
**Post date:** [February 9, 2022, 2:43pm UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/5 "2022-02-09T14:43:45Z")

</div>

problem is fixed 🙂

now ı can try to text on mesh

ı can fixed image on mesh but ı cant to same thing for text

const url = URL.createObjectURL(file); for image

const url = value.createObjectText(value); for text // wrong code

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [March 11, 2022, 11:30am UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/6 "2022-03-11T11:30:03Z")

</div>

Hello @Knifepro just checking in, do you still have any questions?

---

<div class="post-metadata">

**Author:** ![Knifepro](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/knifepro/32/39429_2.png) [@Knifepro](https://forum.babylonjs.com/u/Knifepro)\
**Post date:** [March 11, 2022, 11:42am UTC](https://forum.babylonjs.com/t/simple-camera-focus/27433/7 "2022-03-11T11:42:58Z")

</div>

i fix the problem thanks
