Variable assigned to an arcRotateCamera updates unexpectedly

I have encountered a strange problem with a variable value changing after assigning to a property of an arcRotateCamera. I created a camera_prop object with a property called target. I assigned the value to a new BABYLON.ArcRotateCamera. Using the onAfterCameraRenderObservable property of scene, the value changes as I pan the screen. Even more strange, I deconstructed the into variables x,y,z and the deconstructed variables remained the same and the changes when I pan the screen.

Below is the playground that I utilized to illustrate the issue that I have having:

Camera variable assignment issue | Babylon.js Playground

  • In line 6, I created the object, camera_prop
  • In line 7, I gave the object a property of target
  • In line 31, I assigned the property to be equal to my
  • In line 113, I deconstructed x,y,z from
  • In line 115, I console.log and x,y,z.

After those steps above, opening the dev tools window shows that the changes when panning is done on the screen, while x,y,z remains the same. I would love an explanation of this weird behavior.

The following are pictures of the code that I have added to the playground to illustrate this problem. setObject .


The following is the dev tools console when I pan the screen.

As illustrated above, the x variable in vector changes while the deconstructed variables remain unchanged.

Would think that the deconstruction values for x, y and z are fixed at the time of deconstruction and so will not change as the object values change.

I am confuse why changes in value. After assigning to a vector3 value, I do not update it again. Does the value of the vector3 object change on its on when you pan the screen?

Am I correct to write that after deconstructing the object, the variables I have created from it are static and will no change. As for the object, the values will change based on the panning of the screen?