I'm adding a plane entity to Cesium as the folowing:
let position = Cesium.Cartesian3.fromDegrees(long, lat, alt)
let planeEntity = this.viewer.entities.add({
position: position,
model: {
uri: './assets/cesium/Cesium_Air.glb',
minimumPixelSize : 64
}
});
I get plane locations at realtime, each time location arrived I do:
planeEntity.position = Cesium.Cartesian3.fromDegrees(long, lat, alt);
and move the plane to that location.
I want to rotate the plane head to the right place (if the plane flight up, the head cant stay to the left).
How can I calculate bearing rotation from 2 positions? (current position and the next position)?