Hello,
I’m looking for help, I’m using a SampledPositionProperty with multiple position and date, the problem is that I just have the starting and end point of my travel…
Here is my code :
const path = Cesium.Cartesian3.fromDegreesArray([
3.7576594754127517, 43.44211949417701,
3.758013659020274, 43.44226360677331,
3.758142332274086, 43.44238045457237,
3.758138, 43.44235,
3.75817, 43.442348,
3.758281, 43.442462,
3.758318, 43.442583,
3.758343, 43.44331,
3.758344, 43.443351,
3.758337, 43.443462,
3.758357, 43.443521,
3.758391, 43.443591,
3.758369, 43.443623,
3.758342, 43.443711,
3.758339, 43.443894,
3.758336, 43.443974,
3.758334, 43.444146,
3.758331, 43.444261,
3.758331, 43.444312,
3.758292, 43.444344,
3.758296, 43.444403,
3.758308, 43.444601
]);
var now = new Cesium.JulianDate();
var startDate = Cesium.JulianDate.fromIso8601(input.declaration_date);
var lastDate = startDate;
var lastPosition = batch.position.getValue(now);
var position = new Cesium.SampledPositionProperty();
position.addSample(startDate, lastPosition);
for(var coordinate of path){
lastDate = Cesium.JulianDate.addSeconds(lastDate,
lastPosition.timeToReach(coordinate, settings.cesium.truckSpeed), now);
lastPosition = coordinate;
position.addSample(lastDate, coordinate);
}
I’ve tried to print my position every time the for loop ended but it always shows 2 positions…
Thanks for your potentials feed back,
Vincent