Hello Developers,
Actually my problem is that the Heading is not showing properly in Cesium sample model. The data which i getting from live broadcast feeds.
if i put that heading to air or ground model its show me the heading or bearing in different direction.
so the orientation part is not working.
i am giving you the some sample coords and those coords i am using like live feeds one by one.
Here is my sample code you can run this code on sandcastle and check:
var demoCoords = [79.052073,21.086057,320.04,324,79.037892,21.10405,373.38,324,79.03595,21.106505,411.48,324,79.034322,21.1086,457.20000000000005,324,79.033101,21.110183,495.3,324,79.031728,21.111998,541.02,324,79.029897,21.114326,571.5,324,79.028254,21.116455,609.6,324,79.026606,21.118607,632.46,324,79.025625,21.119819,647.7,324,79.023285,21.122845,670.5600000000001,324,79.022217,21.124149,678.1800000000001,324,79.0212,21.125499,693.4200000000001,324,79.018366,21.129135,716.2800000000001,324,79.016668,21.131287,731.52,324,79.01487,21.133575,762,324,79.011175,21.138245,784.86,324,79.009145,21.140768,800.1,323,79.005992,21.144725,822.96,323,79.004084,21.147079,822.96,323,79.000588,21.15152,845.82,323,78.996023,21.157247,914.4000000000001,323,78.993988,21.159761,960.12,323,78.988653,21.166397,1059.18,323,78.987528,21.167722,1653.5400000000002,323,78.704357,21.021268,3429,228,78.694769,21.013261,3505.2000000000003,228,78.686387,21.006226,3558.54,228,78.679588,21.000552,3611.88,228,78.675695,20.997253,3657.6000000000004,228,78.670099,20.992592,3672.84,228,78.664365,20.987823,3710.94,228,78.660761,20.984818,3733.8,228,78.658284,20.982742,3756.6600000000003,228,78.651172,20.976837,3802.38,228,78.646778,20.973133,3825.2400000000002,228,78.642134,20.969269,3855.7200000000003,228,78.636691,20.964754,3893.82,228,78.631701,20.960587,4236.72,228];
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false,
shadows : false
});
viewer.entities.removeAll();
var position1 = Cesium.Cartesian3.fromDegrees(79.052199,21.085991,0);
var HPR = new Cesium.HeadingPitchRoll((Cesium.Math.toRadians(270)), 0, 0);
var orientation1 = Cesium.Transforms.headingPitchRollQuaternion(position1, HPR);
var entity = viewer.entities.add({
id:"ABC",
name : "ABC",
position : position1,
orientation : orientation1,
model : {
uri : '../../SampleData/models/CesiumAir/Cesium_Air.glb',
minimumPixelSize : 128,
maximumScale : 20000
}
});
var counter =0,
interval;
function startSimulator(){
var lengthtoLoop = demoCoords.length / 4;
if(lengthtoLoop !== demoCoords.length){
var _LON = demoCoords[counter],
_LAT = demoCoords[counter + 1],
_ALT = demoCoords[counter + 2],
_HDG = demoCoords[counter + 3];
var EntityToUpdate = viewer.entities.getById("ABC");
if (EntityToUpdate !== undefined){
var newCoords = Cesium.Cartesian3.fromDegrees(_LON, _LAT, _ALT);
var newPosition = new Cesium.ConstantPositionProperty(newCoords);
EntityToUpdate.position = newPosition;
var newHPR = new Cesium.HeadingPitchRoll((Cesium.Math.toRadians(_HDG)), 0, 0);
var neworientation = Cesium.Transforms.headingPitchRollQuaternion(newCoords, newHPR);
EntityToUpdate.orientation =neworientation;
}
counter += 1;
interval = setTimeout(startSimulator, 1000);
}else{
clearTimeout(interval);
}
}
startSimulator();
viewer.trackedEntity = entity;
i am giving you the some sample coords and those coords i am using like live feeds one by one.
can you please sort me out the problem, it will very help to me.
thank you guys.