WebGL中节点动画需要随着小车的运动轨迹改变镜头,如何实现

0 投票
try{
            //添加S3M图层服务
            var promise = scene.open(URL_CONFIG.SCENE_JINJIANG);
            Cesium.when(promise,function(layers){
                //设置相机视角(这里改如何改动)
                scene.camera.setView({
                    destination : new Cesium.Cartesian3.fromDegrees(118.5486,24.8027,80),
                    orientation : {
                       heading : 5.295661577745349,
                       pitch : -0.18831704619320822,
                       roll : 0
                   }
                });
            },function(e){
                if (widget._showRenderLoopErrors) {
                    var title = '渲染时发生错误,已停止渲染。';
                    widget.showErrorPanel(title, undefined, e);
                }
            }).then(function(){
                //加载kml文件
                viewer.dataSources.add(Cesium.KmlDataSource.load('./SampleData/kml/model.kml',{
                    camera : scene.camera,
                    canvas : scene.canvas
                })).then(function(kmlDatasource){
                    var entity = kmlDatasource.entities.values[0];
                    if(entity.path){
                        entity.path.show = false;
                    }
                });
            });
        }
7月 7 分类:  66次浏览 | 用户: Marry 初出茅庐 (35 分)

1个回答

0 投票

您好,您看下这个示例,选中小车时镜头会跟着移动,希望对您的工作有帮助。

交通仿真示例:

http://support.supermap.com.cn:8090/webgl/examples/editor.html#trafficSimulation

7月 7 用户: jjz 名扬四海 (1,223 分)
我想点击一个按钮将这些小车移除该怎么做

您好,可以把小车放在entity控制show的属性。

Entity API:

http://support.supermap.com.cn:8090/webgl/Build/Documentation/Entity.html?classFilter=entity#show

...