# ArcRotateCamera updating target behaves differently when using add or addInPlace

**URL:** <https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876>\
**Category:** Bugs\
**Tags:** arcrotatecamera\
**Created:** [February 22, 2022, 1:50pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876 "2022-02-22T13:50:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Ceravolo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rafael_ceravolo/32/20209_2.png) [@Rafael\_Ceravolo](https://forum.babylonjs.com/u/Rafael_Ceravolo)\
**Post date:** [February 22, 2022, 1:50pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876/1 "2022-02-22T13:50:08Z")

</div>

Hi,

I was updating just the target of a ArcRotateCamera, by calling:  
`camera.target = camera.target.add(offset); // where offset is a Vector3`

But when doing this, the alpha and beta of the camera was also changing.

Replacing the add with addInPlace, it works as expected (alpha an beta are note changed):  
`camera.target.addInPlace(offset); // where offset is a Vector3`

See the problem in playground (open the console to see the alpha/beta changing):

> **[Babylon.js Playground](https://playground.babylonjs.com/#SRZRWV%23803)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Using addInPlace solved my the problem, but shouldn’t using add() have the same behaviour as addInPlace() in this case? Is this a bug?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [February 22, 2022, 2:21pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876/2 "2022-02-22T14:21:26Z")

</div>

They do not have the same behavior cause target is a property internally calling into setTarget when set which is not the case when you update the values internally only.

Changing the values only will actually not update the angles which is usually the desired behavior when moving a target.

---

<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 24, 2022, 1:16pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876/3 "2022-03-24T13:16:14Z")

</div>

Hi @Rafael_Ceravolo just checking in if Seb’s explanation made things clear for you 😃

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [March 24, 2022, 1:25pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876/4 "2022-03-24T13:25:29Z")

</div>

As per my experience, I can confirm ‘setTarget’ (to set a new target with new alpha, beta and radius) should be used (and works perfectly).

---

<div class="post-metadata">

**Author:** ![Rafael\_Ceravolo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rafael_ceravolo/32/20209_2.png) [@Rafael\_Ceravolo](https://forum.babylonjs.com/u/Rafael_Ceravolo)\
**Post date:** [March 25, 2022, 9:34pm UTC](https://forum.babylonjs.com/t/arcrotatecamera-updating-target-behaves-differently-when-using-add-or-addinplace/27876/5 "2022-03-25T21:34:23Z")

</div>

Yes, It made sense.

In my case, I didn’t want the usual behaviour, I wanted to pan the camera to a new target, but keeping the same angles, so updating the target inplace worked fine.

Thanks for the followup!
