Set origin externally

For a simulation type project, I currently set a hardcoded latitude/longitude in the Editor. This is then packaged as a project. Everything works well.

Is there a way to somehow pass latitude/longitude externally?
Ideally I can just add them as command line arguments to my unreal project binary.

Hi @petergerten

We haven’t experimented with passing coordinate parameters through command line arguments (I’m not entirely sure if its even possible).

Just to be sure of what you are looking for, please confirm my understanding:

You want to have a packaged executable, built using Cesium for Unreal, that a user can run as myexecutable.exe --longitude 123 --latitude 45 and it opens up the globe to that coordinate location?

If this is correct, a follow up question: Why command line arguments as opposed to creating a UMG widget that allows users to enter latitude/longitude, that can be used with blueprints to set the location of the georeference?

You want to have a packaged executable, built using Cesium for Unreal, that a user can run as myexecutable.exe --longitude 123 --latitude 45 and it opens up the globe to that coordinate location?

yes, exactly.

If this is correct, a follow up question: Why command line arguments as opposed to creating a UMG widget that allows users to enter latitude/longitude, that can be used with blueprints to set the location of the georeference?

The reason is, that the project is not a traditional game with UI but a simulator which runs headless and graphics is extracted through a different pipeline.

@petergerten thanks for the clarification. I don’t think we’ve tried it internally, but according to Command-Line Arguments | Unreal Engine Documentation, seems likes its possible. I assume you will need to create a blueprint to read the command line arguments and then set the geoferences based on that.

I’ll lets others chime in who may have done something similar.

Here is another tutorial that does a similar thing with CLI arguments Accessing command line arguments at runtime — Unreal Engine — UTS Data Arena

Thanks!

As a first step - just to set the origin programmatically from a Blueprint - does anyone have pointers on how this works? My (non successful) attempt looks like this:

You have to reference the CesiumGeoReference component in your map level. This is what I current have in my level blueprint on BeginPlay (the Origin value I’m injecting is a vector variable):

If you were doing it from an external blueprint, you could probably do a Get All Actors of Type or Get All Actors With Tag I think