The best way to learn about the Unity coordinate system is from the Unity documentation. This page is a good place to start:
For the Cesium for Unity coordinate system, the comments on the CesiumGlobeAnchor and CesiumGeoreference components may help. But mostly it’s pretty straightforward: The CesiumGeoreference makes it so that the Unity world coordinates are centered on the georeference origin you’ve specified and Unity’s +X axis points East, its +Y axis points Up, and its +Z axis points North.
But setting the position from longitude/latitude/height should be really simple if you’re using a CesiumGlobeAnchor:
anchor.SetPositionLongitudeLatitudeHeight(longitudeDegrees, latitudeDegrees, heightAboveWGS84EllipsoidMeters);
Setting the orientation from heading/pitch/roll is a little more complicated, because we have to be clear about what exactly heading, pitch, and roll are. But essentially, we’ll convert that sequence of rotations into a quaternion, and then set the rotationEastUpNorth
property.
Unity has two quaternion classes. One is UnityEngine.Quaternion, and the other is Unity.Mathematics.quaternion. The rotationEastUpNorth
property takes the latter, but there’s also an implicit conversion from the former, so basically you can use whichever you prefer.
Now, “East-Up-North” literally means that the X axis points East, the Y axis points Up, and the Z axis points North. So we need to create a quaternion that rotates from the given heading-pitch-roll to that coordinate system. Quaternion.Euler, as mentioned by @paulgee32, is a good place to start. The documentation says:
Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis; applied in that order.
If you look at the CesiumGlobeAnchor component in the Editor, the East-Up-North rotation value is shown in the UI using Euler angles. So you can play around with these and see how they relate to your understanding of the heading-pitch roll.
So I have to make some assumptions here. Let’s say your model has +X forward, +Y up, and +Z left. And heading is the angle from North toward East. Positive Pitch makes the nose point up. Positive Roll is a bank left. If I have that all right, you shoud be able to set your angles like this:
anchor.rotationEastUpNorth = Quaternion.Euler(roll, heading - 90, pitch);
If any of the details of that are wrong, you’ll have to adjust accordingly. The best way is to add your model to the scene with a globe anchor and manually adjust the Rotation East-Up-North rotation in the UI to understand how it relates to your heading-pitch-roll.