# Unable to update ArcRotateCamera position

**URL:** <https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181>\
**Category:** Questions\
**Created:** [November 11, 2021, 3:49pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181 "2021-11-11T15:49:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![padronhosnai](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/padronhosnai/32/16700_2.png) [@padronhosnai](https://forum.babylonjs.com/u/padronhosnai)\
**Post date:** [November 11, 2021, 3:49pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/1 "2021-11-11T15:49:41Z")

</div>

Hey there!

In my project, I have an ArcRotateCamera in my scene and, at some point in time, I would like to move the camera around programmatically. However, changing camera.position.x, for example, doesn’t seem to be working.

Here is a PG where I have set up a similar scenario. I am trying to change the position of the camera inside registerBeforeRender, but it seems like it is not working. [https://www.babylonjs-playground.com/#12WBC#1248](https://www.babylonjs-playground.com/#12WBC#1248)

Any ideas?

Thanks in advance!  
Ilde.

---

<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:** [November 11, 2021, 4:46pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/2 "2021-11-11T16:46:47Z")

</div>

Seems that you need alpha or radius (or both) parameters of ArcRotate camera - [https://www.babylonjs-playground.com/#12WBC#1250](https://www.babylonjs-playground.com/#12WBC#1250)

---

<div class="post-metadata">

**Author:** ![padronhosnai](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/padronhosnai/32/16700_2.png) [@padronhosnai](https://forum.babylonjs.com/u/padronhosnai)\
**Post date:** [November 11, 2021, 4:49pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/3 "2021-11-11T16:49:37Z")

</div>

Yeah, updating the alpha works. But I’d like to update the position vector directly. Is that possible?

---

<div class="post-metadata">

**Author:** ![msDestiny14](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/msdestiny14/32/9572_2.png) [@msDestiny14](https://forum.babylonjs.com/u/msDestiny14)\
**Post date:** [November 11, 2021, 5:09pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/4 "2021-11-11T17:09:00Z")

</div>

Yep it’s possible! You have to set the position vector entirely. I changed your demo to be:

```auto
 var x = 0;
    scene.registerBeforeRender(() => {
        camera.position = new BABYLON.Vector3(x++,0,0);
    });

```

[https://www.babylonjs-playground.com/#12WBC#1254](https://www.babylonjs-playground.com/#12WBC#1254)

Also for a more in depth example I suggest you take a look at this demo. I like it a lot cause it shows panning with the mouse and then updating the position of the camera based on that:  
[https://playground.babylonjs.com/#5QBZT0#9](https://playground.babylonjs.com/#5QBZT0#9)

Take a look at line 160 where it updates the target instead.  
`camera.target.addInPlace(panVec);`

---

<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:** [November 11, 2021, 5:09pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/5 "2021-11-11T17:09:39Z")

</div>

It is possible - [https://www.babylonjs-playground.com/#12WBC#1253](https://www.babylonjs-playground.com/#12WBC#1253)  
Still I wouldn’t recommend to use this solution in the render loop - there will be too many Vector3 objects.

---

<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:** [November 11, 2021, 6:44pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/6 "2021-11-11T18:44:50Z")

</div>

Hello!  
You have to recalculate the angles after you change the position or the target of an ArcRotateCamera.

```auto
        camera.rebuildAnglesAndRadius()

```

[https://www.babylonjs-playground.com/#12WBC#1255](https://www.babylonjs-playground.com/#12WBC#1255)

---

<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:** [November 11, 2021, 11:38pm UTC](https://forum.babylonjs.com/t/unable-to-update-arcrotatecamera-position/25181/7 "2021-11-11T23:38:36Z")

</div>

@roland Your solution is the best one 🙂
