Hello all and, thank you Omar for the kind reception.
As the subject describes, I am simply trying to move a 3D entity from one coordinate to another.
Data arrives via web sockets and I parse the needed values (lat,lng, etc).
This is my current situation; I can get my entities to move properly OR I can update their orientation but not both.
I’m limited in what code I share and I apologize profusely. Most of my work deals with government related matters and is sensitive in nature.
Thank you very much! (It feels weird being a noob again LOL!)
Don
This is how I add an entity (Entity is placed in the correct location and with correct initial orientation):
function addEntity(data) {
console.log("addEntity");
//console.log(data);
var height;
var positions = [
Cesium.Cartographic.fromDegrees(data.longitude, data.latitude),
];
var promise = Cesium.sampleTerrainMostDetailed(worldTerrain, positions);
Cesium.when(promise, function(updatedPositions) {
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(data.longitude, data.latitude, positions[0].height));
var position = Cesium.Cartesian3.fromDegrees(data.longitude, data.latitude, positions[0].height);
var heading = Cesium.Math.toRadians(data.heading);
var pitch = Cesium.Math.toRadians(15.0);
var roll = Cesium.Math.toRadians(0.0);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, new Cesium.HeadingPitchRoll(heading, pitch, roll));
var entity = viewer.entities.add({
id: data.guid,
position : position,
orientation : orientation,
model : {
uri : 'models/policecrownvic.glb',
modelMatrix : modelMatrix,
scale : 100.0
}
});
});
};