I am trying to to display an entity with a billboard with a given heading, relative to the direction of the north. The camera must be centered on the billboard and follow its movements and rotations. The goal is to track an helicopter's movement by staying above it and rotating with it.
I could use the Cartesian3.ZERO axis to make sure the billboard is always aligned with the camera ; however, in my case, I need to rotate the billboard independently of the camera's heading, so this is not an option. Therefore I use the UNIT_Z axis and apply the same angle to both the billboard and the camera.
However, it seems the camera's rotation and the billboard's rotation are not aligned, despite using the same angle and a camera direction aligned with the entity and the center of the earth. At multiples of 90 degrees, everything works fine ; the billboard does not appear to be rotated, as the camera rotation matches its own rotation perfectly.
However, when the angle of both the camera and billboard are anything other than 90/180/270/360 degrees, the billboard appears to be rotated, even though it should not. The difference in terms of angle is the greatest for 45/135/225/315 degree, and follows a roughly sinusoidal curve, similar to this :
The value of the "factor" depends on the viewer's size.
In the following SandCastle, you can see that if the ROTATION angle is not a multiple of 90 degrees, the camera and billboard are not aligned. If you resize the cesium viewer, you will notice that the billboard appears to be rotating while the map isn't.
Any idea how to solve this ? Is this an issue with Cesium (After doing a bit of research, I saw that there used to be an issue with billboards and UNIT_Z axis, but it has been marked as solved) or am I doing something wrong ?
Thank you for your help.