How to change default angel of kml tour function?

Like given example, we created a kml file with gx:Track , then use following codes:

viewer.dataSources.add(Cesium.KmlDataSource.load(‘kml file’, options)).then(function(dataSource)

{

kmldh=dataSource;

viewer.clock.shouldAnimate = false;

var rider = dataSource.entities.getById(‘tour’);

viewer.zoomTo(rider).then(function(){

//viewer.trackedEntity = rider;

//viewer.selectedEntity = rider;

viewer.clock.multiplier = 0.3;

viewer.clock.shouldAnimate = true;

viewer.clock.clockRange=Cesium.ClockRange.LOOP_STOP;

});

});

kmldh is a function for a button.

We hit the button, track is on, but the camera is fixed on a default angle, so we remove viewer.trackedEntity and viewer.selectedEntity to move camera freely, still not convenient.

How to change this default camera angle?

Could it be something like viewer.camera.flyTo that we could set our own orientation for a better view?

Further more, when and only when the track is on, it became extremely lag, only 4 fps. and it’s impossible to move camera where you like.

After we have another button to remove this dataSource, it’ll go back to 60 fps.

Any ideas?

Thank you.

probably something in KmlTourFlyTo()

but in the API doc I don’t found exactly how to write it

Further more, is there any list of supported kml functions?

While this question remains, we’ve tried many different ways to achieve our goals.like gx:Tour and gx:FlyTo

but the Cesium tells that KML Tour unsupported node

在 2018年8月28日星期二 UTC+8上午10:40:21,Karl Tian写道:

Hi Karl,

A more flexible “follow camera” has been requested before, and we have an issue open for it, #5241. In the meantime, you should be able to customize the camera behavior. Take a look at the Camera Tutorial for more information.

#873 has a detailed list of what is supported in terms of KML.

Thanks!

Gabby

Hello Gabby,

So glad to hear that, I can’t wait to have that new feature available!

But viewer.camera.setView is not working

my code like this

viewer.dataSources.add(Cesium.KmlDataSource.load(‘kml/BikeRide2.kml’, options)).then(function(dataSource)

{

viewer.camera.setView({

orientation: {

heading : Cesium.Math.toRadians(240.0),

pitch : Cesium.Math.toRadians(-30.0),

}

});

kmldh=dataSource;

viewer.clock.shouldAnimate = false;

var rider = dataSource.entities.getById(‘tour’);

viewer.zoomTo(rider).then(function(){

viewer.trackedEntity = rider;

//viewer.selectedEntity = rider;

viewer.clock.multiplier = 0.3;

viewer.clock.shouldAnimate = true;

// viewer.clock.clockRange=Cesium.ClockRange.LOOP_STOP;

});

});

Still with kml tour going, camera view is fixed on a default angle

Any more ideas?

Thank you.

Gabby Getz gabby@cesium.com 于2018年8月30日周四 上午4:58写道:

Hi Karl,

If you do come up with a good camera follow feature, the contribution would be greatly appreciated! :grinning:

For setView, you should also specify a destination, for example:

camera.setView({
    destination : new Cesium.Cartesian3(x, y, z),
    orientation: {
        heading : headingAngle,
        pitch : pitchAngle,
        roll : rollAngle
    }
});

You can create a BoundingSphere of the entities in the dataSource, then use the center position as the destination.

Thanks,

Gabby