Howto handle player spawn and spatial loaded geometry?

The problem
In a World Partition level you generally want most level content such as geometry spawned spatially, i.e. loaded when the player is near. But when the player is teleported and the spatially geometry loads the character is for a brief moment in the air, leading to getting stuck once the architecture loaded.

Approach
Is there a recommended approach to solve this issue? The first idea is to maybe change the player location, the height shortly after teleportation. But perhaps there are other things like some sort of preloading feature?

Looking forward to your input

One approach would be to wait until the world partition region is done loading, then do a capsule trace from quite high up to find the floor at the desired teleport coordinates. Then you will know the location to move the player character without them being inside any other actor.

For indoor or covered teleports, instead of a trace down, you can do a couple of traces or samples in a limited region around the teleport coordinates to find a clear area.

Some more searching and found this info

Streaming sources are components that define a position in the world and trigger the loading of cells around them. Player Controllers are a streaming source. Other streaming sources can be added to the world using the World Partition Streaming Source component. For example, a streaming source component can be activated at the location that a player will teleport to, so it can load the cells there. Once the grid cells are loaded, the player teleports to the location and the streaming source component is deactivated. Since there is no longer a streaming source at the player’s previous location, those grid cells would be unloaded. World Partition in Unreal Engine | Unreal Engine 5.6 Documentation | Epic Developer Community

Will add this World Partition Streaming Source component to my player and test later!

Won’t work

You need to do the work manually.

Usually loading screen for cover, spawn player, run trace tests for viability of spawn - adjust based on results and re-test recursively so that eventually a viable spawn is found.
Once found, remove loading screen.

1 Like

The following steps preload the spawning zone. There is currently a delay to account for loading time, this might be adjusted and likely also is affected by client lag.

Steps for spartial spawning

  1. Create a Blueprint and add the WorldPartitionStreamingSource, I guess most projects should be fine with the default settings.
  2. Additional add a vector variable and expose on spawn, editable to communicate the world location.
  3. In your project when the player location is loaded spawn the Blueprint with the WPSS and add location info and other references you might need, i.e. reference to the pawn.
  4. As mentioned by @MostHost_LA add a loading screen and you likely want to prevent movement until spawning has commenced.



Also disable physics on player

1 Like

Small update, adjusted the loading range from 10.000 down to 1.000, to avoid loading issues and still serves the purpose, but unclear if this is only a debug feature. And increased the priority.

Just do it manually.
Add a sphere collider to the character, change the size (radius) of it on load and enable sweep - see how many results you get. Iterate until you know for a fact you have “things” loaded around the player.