I’m using Cesium for Unreal engine plus MathWorks tools to try and do some city-to-city flight simulation. The flight simulation in Simulink (MathWorks) pipes a new X Y Z or LLA value to Unreal engine at each tick.
In Unreal, I have a blueprint which reads the LLA values at each tick and supplies them to an actor with a cesium anchor component attached and auto-possessed by player0. The new LLA values are set using the blueprint “inaccurate teleport to LLA” block.
When/if I supply a sufficiently far away new set of LLA values (e.g. Boston to Bangkok), my actor to the appropriate location, but is incorrectly oriented. This indicates that the rebasing did not occur. If I intend to teleport across large distances, do I need to manually add in a rebasing check and move the georeference? It seems that, if I also set the Cesium Georeference component to the new LLA values at each tick, the orientation of my actor is correct.
Based on your mention of an “inaccurate” function, it sounds like you’re using UE4. We’re no longer releasing new versions of Cesium for Unreal for UE4, so you’re running an older version.
In fact in newer versions, we don’t automatically rebase at all. UE5 has double-precision coordinates, so this rebasing tends to cause more problems then it solves.
But back in UE4, the rebasing doesn’t work by moving the georeference. It works by changing Unreal’s “World Origin Location”. This kind of rebasing is translation only - it doesn’t and can’t change the orientation.
So, to solve your problem, you have a couple of options. One is to manually change the CesiumGeoreference origin as you move, as you mentioned. Another - perhaps better? - option is to use the sub-level system. Sub-levels allow you to simultaneously activate new actors and also set the georeference origin to the one those actors expect when approaching a new area of the globe. Learn more here:
Thank you for the feedback. Yes, you are correct. I am stuck in UE4.27 for a while, so I will be using that.
I explored the use of sublevels for moving between specific cities. However, it seems that there is some issue with the way that we are “teleporting” the object. I don’t know if it is actually loading the sublevels appropriately. This also seems to require some setup… needing me to define sublevels in every part of the world I intend to move. It seems that, without the appropriate sublevel nearby, the actor still ends up upside down or otherwise ill-posed.
I will test that. In the meantime, I think that the teleportation method is probably fine. Although it seems like I’m getting some other odd behavior with this method… I don’t know if it’s coming from Unreal, Cesium, or the MathWorks interface. I’ll do some more investigation and follow up.
Adding a GlobeAnchorComponent should help to keep objects upright on the globe. Cesium for Unreal for UE4 has been deprecated for awhile now, though, so I can’t really say for sure what bugs might be lurking in those old versions. You can check the changelog to see if anything looks relevant: