Sampled Property - HeadingPitchRoll

Hi,

I’m trying to create a sampled property of type HeadingPitchRoll.

When I try:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

function storeHeading() {

var hdg = new Cesium.SampledProperty(Cesium.HeadingPitchRoll);

                    // var hdg = new Cesium.SampledProperty(Cesium.HeadingPitchRoll.fromDegrees);  // Other attempt

//Populate it with data

hdg.addSample(Cesium.JulianDate.fromIso8601(‘2012-08-04T10:00:02Z’), Cesium.HeadingPitchRoll.fromDegrees(88.3, 0, 0));

return hdg;

}

var h = storeHeading();

``

I get the error: “Uncaught TypeError: innerType.pack is not a function (on line 562 of http://cesiumjs.org/Cesium/Source/DataSources/SampledProperty.js)”

Please would it be possible to tell me where I am going wrong?

Without being rude, after quite a bit of Googling and it does seem that a simple function to put a model in the air at a position and at a heading / roll / pitch would help an awful lot of people!

Thank you,

Hugh

1 Like

HeadingPitchRoll is not interpolatable, which is required for use with sampled properties. Convert each of your samples to Quaternion using the Quaternion.fromHeadingPitchRoll function. Additionally, the orientation entity property requires a property of type Quaternion anyway.

1 Like

Thanks, Scott.