Moving relative to earth


I used one of the Cesium conversion functions to get the altitude, which worked great, but now I’d like to move around the earth.

Using forward and right vectors from the camera almost works, but breaks down at very high altitudes.

Are there any functions that would allow me to move in a way that more closely matches an orbit?



For this behavior, we recommend using the FloatingPawn that comes within the plugin. It lets you move around the round globe without getting the camera disoriented. Learn how to find and use the FloatingPawn here.

If you want to implement custom orbiting-like movement, you may want to have a longitude-latitude-height representation of your camera location handy and then change only the longitude and latitude with time. These can then be converted to Unreal coordinates every frame using the appropriate conversion function. These Unreal coordinates can then be set as the location of the camera. This approach may be jittery though, since Blueprint uses single-precision floats.

Thanks for the response, but I’m unable to produce the kind of movement I’m looking for with either of these methods.

The default FloatingPawn moves completely independently of the earth (aside from an altitude speed boost). Looking at the earth from a distance, moving right should spin the globe. It almost does this, but because the altitude is not locked to the earth, you get further away and eventually glitch back and forth around the earth. This is unnatural for a satellite.

Moving based on lat long alt looks fine at first and does rotate the earth when moving right, but it follows lines of longitude. That is, it makes a tighter path near the poles than on the equator. This is also unnatural for a satellite.

Here’s an example of what I’m trying to do:

Hi @rrioja ,

For accurate orbiting movement you will likely have to implement simple satellite orbiting mechanics in the Earth-Centered, Earth-Fixed (ECEF) coordinate system. You can let your simulation evolve with time and you can set the Unreal position of each satellite each frame by using our conversion functions from ECEF to UE on the default CesiumGeoreference actor. We would recommend writing such a simulation in C++ so you can use double-precision ECEF coordinates and the double-precision version of our conversion functions.

Even for mock satellite-like movement, it may still be worth making your position calculations in ECEF since it is convenient for describing Earth-relative movement.

We look forward to seeing what you will be able to create!

I’ve not been able to produce correct movement with ECEF. I may not be using it correctly, but here’s wat’s happening.

I tried getting getting the actor location, converting to ECEF, changing only a single dimension, and converting to UE. I thought this would cause me to move in a single direction around the earth. Instead, it also changes my altitude drastically.

Am I misunderstanding how to use ECEF?

Hi @rrioja ,

I recommend reading some background on ECEF to understand its definition and usefulness. Changing a single ECEF dimension will not yield orbital behavior. You can parameterize an elliptical path relative to the center of earth (ECEF: (0, 0, 0)). Even simpler you could do something like:
F = m1 * m2 / r^2
where m1 is the mass of the object, m2 is the mass of the earth, r is the magnitude of the object’s ECEF position (which is conveniently the distance from center of earth), and F is the resulting force to be applied to the object for that frame. This force should be applied to the object in the direction of the earth each frame.

If the object has a large tangential initial velocity, it should take orbit. You may have to experiment a bit but the general approach should work. You should probably implement something like this in C++ since it will offer better flexibility in converting back and forth to the appropriate coordinate systems.