I have a marker which I move along a pre-defined GPS route. Updating every second.
My aim is to follow the marker by looking at it so the camera stays behind and looks in he direction it is travelling.
I am calculating the heading of the marker and then using this as the heading of the camera using the following:
//markerHeading is a bearing in degrees.
var heading = Cesium.Math.toRadians(markerHeading);
camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));
It is not giving the results I would expect. The entity is centered fine, but sometimes the camera is in front of the marker i.e. the marker is moving towards it.
From the docs I read this " If the offset is heading/pitch/range, then the heading and the pitch angles are defined in the reference frame defined by the transformation matrix"
I am not 100% sure how I should interpret things from that. Any help/pointers would be great.