使用产品:iClient3D for Cesium 11i
下面是在Projection - Cesium Sandcastle中能运行的代码,改变目标坐标l2的维度37.594795 ->37.596795 ,车头会改变,
我把这段代码复制到我的用supermap的项目里,只有模型的地址不一样,车头不会随移动改变,把now2 的小时改成11, 车头会变
const viewer = new Cesium.Viewer("cesiumContainer", {
});
const property2 = new Cesium.SampledPositionProperty();
let now1 = Cesium.JulianDate.fromDate(new Date( "2023-03-15 11:13:37"));
let now2 = Cesium.JulianDate.fromDate(new Date("2023-03-15 18:15:08"));
let l1 =Cesium.Cartesian3.fromDegrees(114.739534, 37.595127, 10) ;
let l2 =Cesium.Cartesian3.fromDegrees(114.739081, 37.594795, 10) ;
viewer.clock.startTime = now1.clone();
viewer.clock.currentTime = now1.clone();
viewer.clock.stopTime = Cesium.JulianDate.fromDate(new Date( "2023-03-19 11:13:37"));
viewer.clock.clockRange = Cesium.ClockRange.CLAMPED;
viewer.clock.multiplier = 1;
property2.addSample(now1, l1);
property2.addSample(now2, l2);
const entity = viewer.entities.add({
position: property2,
orientation: new Cesium.VelocityOrientationProperty(property2),
model: {
uri: "../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb",
minimumPixelSize: 128,
maximumScale: 20000,
},
});
viewer.trackedEntity = entity;