All you have to do to get it to move is give new values to entity.orientation and entity.position.
Here’s demo where I’m updating the long/lat position, and the heading and pitch for the orientation.
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
infoBox : false,
selectionIndicator : false
});
viewer.scene.camera.setView({
position: new Cesium.Cartesian3(-2654967.1393059366, -4137274.088087724, 4400287.295814132),
heading: 0.005279793055563253,
pitch: -0.818713136947244,
roll: 0.000025898904649324095
});
var lon = -123.0744619;
var lat = 44.0503706;
var position = Cesium.Cartesian3.fromDegrees(lon, lat, 5000.0);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 0;
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);
var url = ‘…/…/SampleData/models/CesiumAir/Cesium_Air.bgltf’;
var entity = viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128
}
});
var sign = 1;
var count = 0;
var i = setInterval(function(){
var diff = Cesium.Math.toRadians(1)*sign;
heading += diff;
pitch -= diff;
lon -= diff;
lat += diff;
position = Cesium.Cartesian3.fromDegrees(lon, lat, 5000.0);
count++;
if (count%50 === 0){
count = 0;
sign *= -1;
}
entity.orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);
entity.position = position;
}, 30);
``