How to convert rotation from ECEF to Unreal

Hi, I am working on a UE5 project related to satellites and payloads.
I have a big trouble… I need to update the position and rotation of the satellite and payload, but I can only get the rotation quaternion of ECEF (from the server), I found that in Cesium for unreal, it seems possible to use CesiumGeoreference, but I found that it only has East North Up to Unreal (without ECEF to Unreal).
My question is: Can this function (or BP node) be used for ECEF rotation to Unreal rotation? Or are there other functions?
Many thanks.

This gets much easier in the v2.0 preview we just released. You can simply add a CesiumGlobeAnchorComponent to your object and then call the SetEarthCenteredEarthFixedRotation method on it.

I think in v1.31.1 you would need to write some C++ code to do it manually.

1 Like

Thanks, I tried the v2.0 preview and it looks pretty good.
By the way, does Cesium for Unreal 2.0 preview only support UE 5.1 or above? Is there a way to support UE 5.0.3? (I put the 5.1 version of v2.0 preview ( CesiumForUnreal-51-v2.0.0-preview1.zip) into UE 5.0.3 for testing, looks fine.)

Yes, Cesium for Unreal v2.0 will only support UE 5.1+. In general, new versions of Cesium for Unreal will only support the three most recent Unreal Engine versions. This is partially because the Unreal Marketplace forbids us from publishing new plugin versions targeting any older releases, and partially because supporting a large number of engine versions imposes a significant maintenance and testing burden on us.

Got it, thanks again.

Hi @Kevin_Ring, do you have an example for a blueprint that would take in the ECEF position and quaternion of the body frame with respect to the ECEF frame and then output that to the corresponding position and rotation for unreal engine? I have been working on my simulation for a while now and am stuck on this part. My Georeference is at the start lat/lon/alt of the simulation but ideally I would like it to be at the true origin of the Earth. Thank you in advance.

Hi @georgenehma,

Cesium for Unreal provides several Blueprints that can handle this conversion, but I would also suggest looking into CesiumGlobeAnchor. This component “anchors” an object to the globe, such that it will automatically adjust the Unreal position to keep it relative to the globe.

In any case, from Blueprints you can check for functions related to the CesiumGeoreference or the CesiumGlobeAnchor. For example:

Let us know if you have any follow-up questions!

hi @janine,

Thank you for the swift reply. So this is what I have for my actor blueprint:


And this is my actor with the Cesium Globe Anchor attached and linked to the Cesium Georeference which is set to be at the True Origin:
image
Yet when I run it I get this:

I am certain that my position and rotation data is correct as I have checked this in MATLAB. What am I doing wrong here?

Hi @georgenehma,

I’m afraid I can’t tell what’s wrong from a glance. Could you please share some example values for your position + rotation, so that I can reproduce this on my machine? We would also appreciate images of the expected position + rotations for comparison. Thank you!

Hi @janine,

So I found a fix for this by setting the Static Mesh rotation (the 180 degrees X rotation is to fix the model being upside down from the CAD model, but Im not sure what the 180 degrees Z rotation is for, im thinking maybe because of the Left hand to right hand coordinate change?) as you can see:

However, you can also see the second pawn in the game, the booster, jitters around a lot as its flying which I am not sure the reason for. The booster is supposed to be attached and it is flying as if it were attached but it will keep jittering around, I thought this was supposed to be fixed with unreal 5?:

I think it may have something to do with how I am attaching the camera, because if I attach the camera to the booster then the vehicle will jitter around. I am using the Set View Target with Blend block for the camera but if you know a better way to do this, please let me know.

This is some of the ECEF position data:
image
and this is the quaternion data:
image

Hi @georgenehma,

I’m glad you found a fix for the rotation math! Yes, I imagine that you’ll have to transform into Unreal’s left-handed coordinate system, if the original model was created in a right-handed one.

I’m not sure what could be causing the jitter. Usually jitter happens as a result of floating point error, but Unreal should be handling that because UE5 uses doubles. Can you confirm:

  • Does the jitter go away or decrease when your object is closer to the CesiumGeoreference?
  • Do you have a CesiumOriginShift on your camera? If so, can you share a screenshot of its settings?

So to alleviate the lighting issue when the Georeference is at the true origin I set the georeference to my initial position in the simulation but I still experience jitter. I have attached an Origin Shift to the cruiser Pawn as shown here:


I have a strong feeling it is because of the Set View Target With Blend, but I am not sure how else to have the camera follow the vehicle as it moves and point at the vehicle. When I remove the Set View Target With Blend function the viewport just remains at the initial position.