How can I copy the new camera view (after user drag)?

How can I copy the new camera view after the user mouse mover to a new position?

I have the following code. It currently still retain the original camera view information.

function setview(){
var camera =;
cameraProperties = {
position: camera.position.clone(),
direction: camera.direction.clone(),
up: camera.up.clone(),
right: camera.right.clone(),
transform: camera.transform.clone(),
frustum: camera.frustum.clone()


The position, direction and up should be sufficient to capture the camera view. This is my go to snippet for saving camera views: How to share custom Sandcastle examples.

Instead of you can also use like in this example:

// Set the initial camera view to look at Manhattan
var initialPosition = Cesium.Cartesian3.fromDegrees(
var initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees(
  destination: initialPosition,
  orientation: initialOrientation,
  endTransform: Cesium.Matrix4.IDENTITY,