Hi experts,
origin post is here,
https://groups.google.com/forum/#!topic/cesium-dev/zrDYU94fCYQ
var viewer = new Cesium.Viewer(‘cesiumContainer’);
`var position = Cesium.Cartesian3.fromDegrees(-105.0, 40.0, 200000.0);
var heading = Cesium.Math.toRadians(135);
var pitch = 45;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
var redCone = viewer.entities.add({
name : ‘Red cone’,
position: position,
orientation : orientation,
cylinder : {
length : 400000.0,
topRadius : 0.0,
bottomRadius : 200000.0,
material : Cesium.Color.RED
}
});
viewer.zoomTo(viewer.entities);`
The orientation property will rotate the cone from its center, not the apex.
Then, I found a similar post
https://groups.google.com/forum/#!topic/cesium-dev/f9ZiSWPMgus
But the code here is only work for below orientation.
var orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
Cesium.Math.toRadians(0.0),
Cesium.Math.toRadians(0.0),
Cesium.Math.toRadians(90.0)
);
it won’t work for other hpr.
var orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
Cesium.Math.toRadians(0.0),
Cesium.Math.toRadians(0.0),
Cesium.Math.toRadians(120.0)
);