Hello, I created 3 sublevels called GlobeSublevel, Ciruelos and WhiteSands.
While in the editor, I am able to teleport to these sublevels at opposite ends of the world by selecting them from Unreal’s Levels menu.
I’m trying to create the same effect when playing/in runtime. Using a widget blueprint, I load the sublevel using “Load Level Instance (by Name)”, but nothing interesting happens. It successfully fires via
WhiteSands sublevel - the level I want to teleport to
GlobeSublevel sublevel - the level I am teleporting from
In action - states that its loaded but nothing happens
I assume that by loading the level, I will teleport to White Sands as well as have White Sands be the new origin with the correct Z direction etc. I suppose I got this concept wrong.
So what I’m trying to achieve here is to have my character teleport from, lets say, Indonesia to Australia with localised assets in each sublevel and have the correct z-direction etc. Any advice how to go about achieving this?
You kind of have it backwards, I’d say. If you teleport the Pawn to the right location, then the sublevel at that location will automatically activate. Activating a sub-level doesn’t automatically cause teleporation (it’s only Editor-specific behavior that accomplishes anything like that).
If you’re using DynamicPawn / GlobeAwareDefaultPawn, you can use the
FlyToLocationLongitudeLatitudeHeight to do a smooth transition between the locations. You can set the
FlyToDuration really short if you like. You can also teleport directly (no transition) by getting the Pawn’s
GlobeAnchor and calling
MoveToLongitudeLatitudeHeight on it.
Hey there! Thanks for the quick reply and advice.
I see, so if I understand you correctly, theres no need to code for the sublevel to load. If I am in the blue wireframe sphere, the sublevel should load automatically.
Question, by extension, do the coordinates reorients itself such that Unreal’s coor is flat against the center of the sublevel?
On the previous note, I wasn’t able to successfully achieve the desired outcome. Here’s what I’ve done so far.
Since I’m using my own actor BP, I added GlobeAnchor into the actor BP (3rd Person Character) itself and used MoveToLongitudeLatitudeHeight as you mentioned.
-My 3rd Person Character BP’s Transform is set to Moveable from the Details panel.
-For the Target Long Lat Height (from MoveToLongitudeLatitudeHeight), I opened up the WhiteSands sublevel>placed a cube there>applied GlobeAnchor on the cube>Use the cube’s Long Lat Height as the Target Long Lat Height inside of my 3rd Person Character’s BP
Starting from near White Sands (seen below)
I then teleport (via Press V key)
While the actor did teleport, it seems like it teleported away relative to White Sands. This is evidenced by pressing Esc from play (after teleport) and then zooming far out from the editor (seen below)
Am I using MoveToLongitudeLatitudeHeight incorrectly?
Also I tried googling documentation for this BP/node but am unable to find the documentation page, is there a link for this?
Hmm some strange stuff in your screenshots. By White Sands, you mean in New Mexico, right? That should be roughly 32 degrees latitude, -106 degrees longitude. But in your screenshot you have -16,128. Also, Longitude needs to be first. I think the incorrect coordinates explain why you’re flying away from the expected location.
White Sands im looking at is in Aussie.
Oh you were right! Needed to swap the lat long. Thanks mate!