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 camera_prop.target value to a new BABYLON.ArcRotateCamera. Using the onAfterCameraRenderObservable property of scene, the camera_prop.target value changes as I pan the screen. Even more strange, I deconstructed the camera_prop.target into variables x,y,z and the deconstructed variables remained the same and the camera_prop.target 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 freeCamera.target property to be equal to my camera_prop.target
  • In line 113, I deconstructed x,y,z from freeCamera.target
  • In line 115, I console.log freeCamera.target.x and x,y,z.

After those steps above, opening the dev tools window shows that the freeCamera.target.x 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 .

consolelogdisplay

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

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 CAMERA_PROP.target changes in value. After assigning CAMERA_PROP.target 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 CAMERA_PROP.target object, the variables I have created from it are static and will no change. As for the CAMERA_PROP.target object, the values will change based on the panning of the screen?