测试代码:使用参数static constant Cesium.ExtrapolationType.HOLD 当超出样本数据范围时,将使用第一个或最后一个值。 但实际上一直是保持第一个值,或者说是向东的方向 ,没法保持最后一帧的方向 。如下代码 测试后会在停止时调车头向正东。 需求是停止时,车保持最后一帧的方向 。 麻烦各位帮看看! 多谢! let czml = [{
"id": "document",
"version": "1.0",
"clock": {
"currentTime": "2020-12-20T16:00:03Z",
"multiplier": 1
}
}, {
"id": "line1",
"name": "XX路线1",
"availability": "2020-12-20T16:00:00Z/2020-12-20T16:05:00Z",
"model": {
"gltf": "../SampleData/models/GroundVehicle/GroundVehicle.glb",
"scale": 1
},
"orientation": {
"velocityReference": "#position"
},
"viewFrom": {
"cartesian": [80, 80, 80]
},
"path": {
"material": {
"solidColor": {
"color": {
"interval": "2020-12-20T16:00:00Z/2020-12-20T16:05:00Z",
"rgba": [255, 0, 0, 255]
}
}
},
"width": [{
"interval": "2020-12-20T16:00:00Z/2020-12-20T16:05:00Z",
"number": 0.0
}]
},
"position": {
"interpolationAlgorithm": "LAGRANGE",
"forwardExtrapolationType": 'HOLD',
"interpolationDegree": 1,
"epoch": "2020-12-20T16:00:00Z",
"cartographicDegrees": [
0.00,108.328947792453,22.7469164044214,0.0,
3.071,108.329388241433,22.7470366141948,0.0,
5.540,108.32928156764,22.7474785429229,0.0,
9.540,108.329014032717,22.7474785429229,0.0
]
}
}]
var dataSourcePromise = new Cesium.CzmlDataSource.load(czml);
// 位置属性
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);
本文由 metyoo 创作,采用 知识共享署名 3.0 中国大陆许可协议 进行许可。 可自由转载、引用,但需署名作者且注明文章出处。