I am looking at the sandbox examples and like the flyTo feature.
What I would like to do is perform a fly to and then track an entity from a given height. I have tried using the “complete” callback function and then tracking the entity in here.
Is there a way to fly to an entity and then track it from a given height? At the moment, it flyTo a location, then jumps to the entity at ground level.
I don’t think there is anything currently in to Cesium to track the entity at a given height. However, here is an example that flies to an entity then tracks it without the camera jumping:
var viewer = new Cesium.Viewer(‘cesiumContainer’, {timeline : false, animation : false});
var pinBuilder = new Cesium.PinBuilder();
var bluePin = viewer.entities.add({
name : ‘Blank blue pin’,
position : Cesium.Cartesian3.fromDegrees(-75.170726, 39.9208667),
billboard : {
image : pinBuilder.fromColor(Cesium.Color.ROYALBLUE, 48).toDataURL(),
verticalOrigin : Cesium.VerticalOrigin.BOTTOM
}
});
My code is almost exactly the same as this. I don’t want to camera to zoom into the marker as close as it does. I am trying to zoom in about 1000 meters above it.
var viewer = new Cesium.Viewer(‘cesiumContainer’, {timeline : false, animation : false});
var pinBuilder = new Cesium.PinBuilder();
var bluePin = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75.170726, 39.9208667),
billboard : {
image : pinBuilder.fromColor(Cesium.Color.ROYALBLUE, 48).toDataURL(),
verticalOrigin : Cesium.VerticalOrigin.BOTTOM
}
});
viewer.scene.camera.lookAt(bluePin.position.getValue(viewer.clock.currentTime), new Cesium.Cartesian3(0,0,1000));
``
The first argument is the pin position. The second argument is a Cartesian3 offset in the pin’s reference frame, so z=1000 puts the camera 1000m above the pin.