RTS style panning

Hi. Using Cesium on UE4 27.1 I am trying to create a sort of top down, RTS style application using the provided Dynamic Pawn. For this example lets say I start over Salt Lake City, Utah, with an altitude of 80,000 which is where my georeference is. Now as I pan east or west as you would do In something like google maps/earth/etc., my altitude increases as I move away from georeference, or decreases back to the initial 80000 the closer I return to it. Ideally I would like the altitude of the Dynamic Pawn to remain at 80000 (or whatever current level it is at) and only have the lat/lon change based on panning direction.

If I go to a different part of the world (e.g., Brazil), with my georeference still over Salt Lake City, then the east and west panning turns into an almost north and south panning instead, which is not at all what I want. Does this have to do with my georeference being where it is versus where my dynamic pawn is?

I am also trying to calculate the speed of panning based on altitude, with closer to the Earth being slower and further away faster, but that also is inconsistent at different heights/arbitrary locations in the world (again with the georeference still over Salt Lake City)

Hi @fullerar,

The Dynamic Pawn was not designed for that style of movement, but we may be able to adjust some settings to make it more usable.

I suspect the reason your altitude is increasing as you move away from the georeference comes from the way that the globe is visualized in Unreal. Unreal’s coordinate system does not account for the curvature of the earth, and so by moving in one direction you may be moving directly along one of the Unreal Engine directional axes. This would be correct in most games but with Cesium for Unreal means that you move further and further from the surface of the earth. This page might be useful to you.

That being said, I never realized that altitude increases as you leave the georeference. It would certainly be better if it didn’t - I’ll take a look and see if there might be a way to fix the dynamic pawn to prevent that.

As distance from the georeference increases, things start generally getting weird. If panning is not behaving properly in Brazil when the georeference is still in Salt Lake City, then your best bet would probably be to move the georeference closer.

As for your speed calculations, try disabling the “Enable Dynamic Speed” checkbox in the Dynamic Pawn settings. That may help - let me know. This one is less likely to be caused by proximity to the georeference but I’m not positive.


Hi @agallegos, thank you for the info, that page you linked is great. I do now have some follow on questions.

  1. One of the suggestions listed on that page you linked said to create sublevels. I have done this before and am not against it, but curious if there is a limit on how many I could/should have? Are they resource intensive? I probably wouldn’t be adding actors to these sublevels if that helps.

  2. You mention moving the georeference closer to Brazil. Is this something I can do dynamically during runtime? So far I have only ever set it through the view port when editing the level. I see the section “We can turn dynamic objects into georeferenced objects” which sounds similar but based on limitation it mentions, maybe sublevels are the way to go for now. I do have the “Keep World Origin Near Camera” already on as suggested.

I will play around with the Dynamic Speed and see, thanks!

I am not aware of any limit on the amount of sublevels you can create. I don’t think that they are resource intensive either. However, I haven’t tested with more than 8 or so. If you’re planning to add many more than that, let me know how it goes! If there is a cap on the amount of sublevels, that would be great to document.

However, if you have “Keep World Origin Near Camera” enabled, it should be automatically moving the georeference. In that case, it’s likely that the orientation issue is not caused by the georeference being in Salt Lake City, but rather something is changing about the georeference orientation itself. I’m going to experiment with this a little more on my side. When you pan, are you simply looking down towards the earth with the Dynamic Pawn and pressing the A and D keys?

Also, you can change the georeference during runtime. If you’re using Blueprint, you will want to use the node Inaccurate Set Georeference Origin, using your level georeference as the target.

The Longitude, Latitude, and Height can be set to predetermined coordinates, or calculated at runtime and converted with an InaccurateTransformUnrealtoECEF node.


Yes A and D work as you described. Funny enough, I just tried using the Inaccurate Set Georeference Origin as you mentioned but that just causes the altitude to continually increase and never decrease since the origin is always changing.

As I look more into it, sublevels may not be a solution for me either. Our altitude
min/max are quite large, and I am not sure I could properly use sublevels that would encompass the various alts without making a sublevel that would take up a very large chunk of the world


The above picture is how I am trying to go about converting the dynamic pawn coords to cesium. Does this seem reasonable?

If you are setting the georeference manually with code or blueprint, you’ll probably want to uncheck “keep world origin near camera”. Otherwise, they might conflict with each other.

The blueprint that you posted should work for getting the dynamic pawn’s coordinates, but you can also get them through the Dynamic Pawn’s Globe Anchor Component - it has an InaccurateGetLongitudeLatitudeHeight function.

There’s been some discussion before about implementing easier camera controls for viewing the earth from above. This issue might be a useful read.

I looked a little further into implementing a pawn like this. You’ll probably want to stop using the dynamic pawn if you’re trying to move strictly north, south, east and west, and up and down. I created a new pawn with a Globe Anchor component, and implemented moving along latitude and longitude and zooming in and out. Here’s a screenshot of my blueprint.

The Zoom input axis is set up to use the space bar as 1 and the left shift key as -1. I also added these nodes to look around.

This doesn’t solve everything, though. The orientation of the camera gets more misaligned the farther you get from the origin. There’s probably some math you could do to correct this - you’d want to do that each time you move the pawn.

I hope this helps - I’ll try to look more in to the camera thing when I get a chance, but if you make any progress on that I’d love to hear it.

Hi Alex,

Thank you very much for all the advice. I ended up taking the movement and zoom examples you gave and added them to our Dynamic Pawn. And then in a few places I am casting to GlobeAwareDefaultPawn to use the InaccurateMoveToLatLonHeight for movement/zoom, whereas before I had been using SetActorLocation, and this seems to greatly help the issues I was having before, while also allowing me to still use Dynamic Pawn.

Strangely enough, I do not seem to notice the orientation issue you mentioned, but will keep an eye out for it

1 Like