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.