Getting Compass vectors

I have a need to show a compass in the game and believe that Cesium can expose vectors to either true or magnetic North (or both?). I’ve looked at what is exposed on a Tile and an object with the GlobeAnchor and for all the global position information I’ve not been able to find any orientation information.
In my application we can jump to different locations but we do this by loading a new level so my need is static and can happen on level load, but if a real time solution is available it would help the most people (and probably me in the future). Any recommendations?

Hello @cevanno,

We have some functions on the CesiumGeoreference actor that should give you the ability to do this. Currently, you can use the ComputeEastNorthUpToUnreal(ueLocation) function to get a rotation matrix from the East-South-Up frame (not a typo, see our pending fix) to the Unreal frame at the given location. The second column vector of this matrix and negate it - this should be a direction in the Unreal frame-of-reference that points North from the given location. This won’t be magnetic North, I think it will be true North though.

Let me know if that works for you!


The 2nd column appears to be the Yplane so I think you are saying to negate its normal vector? Something like this?

Essentially I “think” this works. I took the final vector and connected to a LookAtRotator to rotate my 3D compass needle. A challenge with this stuff is it can appear to work at first but not really be correct.

Also, with your pending fix it would seem my logic will break when that is released, so how would you do the same after your fix is released?

Probably OP doesn’t need this anymore but for anyone looking for another similar response, what worked great for me to know where the poles are was to just transform the real world’s North Pole Lat Long into Unreal Position, and with that I am always getting a vector located at the absolute North in the game. The same should be true with any other real world lat long and you can get the Unreal vector location to position anything there if needed.

Hope this can be useful for similar situations.