Following on from this question: https://groups.google.com/forum/m/#!topic/cesium-dev/4j991i8iazQ if I go the JS rather than CZML route the HeadingPitchRoll demo in the Sandcastle is more-or-less what I want to achieve but with the model following a list of lat / long / height positions and heading / pitch / roll attitudes. I've been trying to use timeIntervalCollections to hold the list of data.
Please would someone be kind enough to suggest how I could best achieve this? I am really stuck.
Thank you,
Hugh
--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
var viewer = new Cesium.Viewer('cesiumContainer', { terrainProviderViewModels : [], //Disable terrain changing infoBox : false, //Disable InfoBox widget selectionIndicator : false //Disable selection indicator});
//Enable lighting based on sun/moon positionsviewer.scene.globe.enableLighting = true;
viewer.trackedEntity = entity;
//Use STK World Terrainviewer.terrainProvider = new Cesium.CesiumTerrainProvider({ requestWaterMask : true, requestVertexNormals : true});
//Enable depth testing so things behind the terrain disappear.viewer.scene.globe.depthTestAgainstTerrain = true;
//Set bounds of our simulation timevar start = Cesium.JulianDate.fromIso8601('2012-08-04T10:00:10Z');var stop = Cesium.JulianDate.fromIso8601('2012-08-04T10:03:10Z');
//Make sure viewer is at the desired time.viewer.clock.startTime = start.clone();viewer.clock.stopTime = stop.clone();viewer.clock.currentTime = start.clone();viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the endviewer.clock.multiplier = 4;
//Set timeline to simulation boundsviewer.timeline.zoomTo(start, stop);
// Add headingfunction storeHeading() { var hdg = new Cesium.SampledProperty(Number); //Populate it with data hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:34Z'), 88); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:35Z'), 87.6); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:36Z'), 87.6); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:37Z'), 88.3); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:38Z'), 89); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:39Z'), 89.7); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:40Z'), 89.7); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:41Z'), 90.1); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:42Z'), 90.8); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:43Z'), 90.8); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:44Z'), 90.8); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:45Z'), 91.2); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:46Z'), 91.5); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:47Z'), 90.8); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:48Z'), 90.4); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:49Z'), 90.4); hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:50Z'), 90.8);
return hdg;
}
//Generate a random circular pattern with varying heights.function computeFlight() { var property = new Cesium.SampledPositionProperty(); // Populate it with data property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:35Z'), Cesium.Cartesian3.fromDegrees(-60.9649963, 13.7333345, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:36Z'), Cesium.Cartesian3.fromDegrees(-60.9649353, 13.7333384, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:37Z'), Cesium.Cartesian3.fromDegrees(-60.9648476, 13.7333422, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:38Z'), Cesium.Cartesian3.fromDegrees(-60.9647331, 13.733346, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:39Z'), Cesium.Cartesian3.fromDegrees(-60.9645958, 13.733346, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:40Z'), Cesium.Cartesian3.fromDegrees(-60.9644279, 13.733346, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:41Z'), Cesium.Cartesian3.fromDegrees(-60.9642372, 13.733346, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:42Z'), Cesium.Cartesian3.fromDegrees(-60.9640236, 13.7333441, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:43Z'), Cesium.Cartesian3.fromDegrees(-60.9637871, 13.7333403, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:44Z'), Cesium.Cartesian3.fromDegrees(-60.9635239, 13.7333364, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:45Z'), Cesium.Cartesian3.fromDegrees(-60.9632378, 13.7333317, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:46Z'), Cesium.Cartesian3.fromDegrees(-60.962925, 13.7333241, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:47Z'), Cesium.Cartesian3.fromDegrees(-60.9625931, 13.7333183, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:48Z'), Cesium.Cartesian3.fromDegrees(-60.9622383, 13.7333145, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:49Z'), Cesium.Cartesian3.fromDegrees(-60.9618607, 13.7333107, 21)); property.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:50Z'), Cesium.Cartesian3.fromDegrees(-60.9614601, 13.7333069, 21)); return property;}
//Compute the entity position property.var position = computeFlight();var hdg = storeHeading(0);
//var heading = Cesium.Math.toRadians(135);var pitch = 0;var roll = 0;var orientation = new Cesium.HeadingPitchRoll( heading, pitch, roll); //Actually create the entityvar entity = viewer.entities.add({
//Set the entity availability to the same interval as the simulation time. availability : new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({ start : start, stop : stop })]),
//Use our computed positions position : position,
/////////////////////////////////////////////////////// //compute orientation // orientation : orientation, /// THIS LINE //Load the Cesium plane model to represent the entity model : { uri : '../../SampleData/models/CesiumAir/Cesium_Air.gltf', minimumPixelSize : 64 },
//Show the path as a pink line sampled in 1 second increments. path : { resolution : 1, material : new Cesium.PolylineGlowMaterialProperty({ glowPower : 0.1, color : Cesium.Color.YELLOW }), width : 10 }});
//Add button to view the path from the top downSandcastle.addDefaultToolbarButton('View Top Down', function() { viewer.trackedEntity = undefined; viewer.zoomTo(viewer.entities, new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-90)));});
//Add button to view the path from the sideSandcastle.addToolbarButton('View Side', function() { viewer.trackedEntity = undefined; viewer.zoomTo(viewer.entities, new Cesium.HeadingPitchRange(Cesium.Math.toRadians(-90), Cesium.Math.toRadians(-15), 7500));});
//Add button to track the entity as it movesSandcastle.addToolbarButton('View Aircraft', function() { viewer.trackedEntity = entity;});
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
var orientation = new Cesium.HeadingPitchRoll( heading, pitch, roll);
needs to be
var orientation = Cesium.Quaternion.fromHeadingPitchRoll(heading, pitch, roll);
I don't see anything else wrong yet, but I'll take another look later.
Cheers,
- Rachel
--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/OGEAvmj9eGc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.
hdg.addSample(Cesium.JulianDate.fromIso8601('2012-08-04T10:00:02Z'), Cesium.Quaternion.fromHeadingPitchRoll(0.0, 0.0, 0.0));