CesiumGeoreferenceComponent::MoveToLongitudeLatitudeHeight(...) crashes Unreal program

Hi there, I’m trying to build a sim using Unreal and Cesium for Unreal, and I’ve created a character that is georeferenced with C++ behind it:

georeference = CreateDefaultSubobject(TEXT(“Character”));
georeference->MoveToLongitudeLatitudeHeight(glm::dvec3(-72.5, 40.5, 100));|

The last line is causing a crash; when it’s commented out the rest of the game works properly. Any ideas on why? I need to update the actor’s location in lat/lon/alt dynamically in C++. Thanks!


Hi @DrSustersic,

What type of object is Character? Is it derived from a Cesium object? The only Cesium object with a MoveToLongitudeLatitudeHeight method is UGlobeAnchorComponent, and I don’t think it would make sense to derive a character from that. If that method is your own, what is its implementation?

Assuming you’re calling MoveToLongitudeLatitudeHeight on a globe anchor component, it may be necessary to call ResolveGeoreference() prior to MoveToLongitudeLatitudeHeight. That shouldn’t cause a crash, but the method may log an error and otherwise do nothing.


Hi Kevin,

Appreciate your thoughts - thanks!

It’s the Unreal ACharacter class (derived from APawn). I’m associating the CesiumGeoreference in the constructor and spawning this character programmatically in C++.

I learned a couple of things since my post - (1) Setting Latitude, Longitude, and Height on the CesiumGeoreference only triggers an update (via call through MoveToLongitudeLatitudeHeight(…) ) in Editor mode (you can see this in the C++ code for CesiumGeoreference). (2) calling MoveToLongitudeLatitudeHeight(…) triggers the exception when invoked in the constructor (guessing something isn’t fully instantiated that the method needs. I was able to get this to work by moving the initial ‘MoveTo…’ call to BeginPlay() method where it makes more sense.

Thanks again!