hi guys! i’ve encountered a problem - i need to stream levels based on my character location, but currently engine streams levels based on camera location, which leads to constant switching of levels when i’m rotating camera around my character (3rd person camera setup). How can i change this behavior, and stream levels based on char loc. Which engine sources are related to lvl streaming or maybe this behavior could be switched with configs?
To my understanding level streaming volumes are based on character location. What makes you think it is based on the camera view angle?
Streaming volumes are handled by UWorld::ProcessLevelStreamingVolumes in LevelTick.cpp and from what it looks it is indeed based on view location. I haven’t looked deeply into this part of the code myself but I think this is a good place to start.
You can edit the code to make it be based on Pawn’s location for example. But be careful becase it might break in situations when your view point is not where your character is. You might end up adding special handling for those situations.
i’m using world composition, but i think that the regular volume work the same way in it’s basic setup (based on camera location) - for them to work based on character you need to set up special blueprint logic with triggering streaming volume on character overlap event, otherwise you’ll end up in situation where if your character enters the volume but camera will be outside - level streaming would not happen. Info on this is present in docs related to blueprint and c++ streaming. It isn’t that obvious because the camera in most of games doesn’t fly too far from character,and at the same time the player is actually the camera in some sortt(like in fps game)
Thanks, i’ll try it! I forgot to mention that i’m using world composition, in that case i also need to start with LevelTick or maybe this system is handled somehow differently?
It’s handled differently.
For world composition it’s handled in WorldComposition.cpp in UWorldComposition::UpdateStreamingState - note that this function comes in three flavors with different arguments, the one that collects player view points is the one without arguments - it’s called from LevelTick every frame when world composition is enabled.
Note that if you will ever need to fix this logic for streaming volumes you will still have to update UWorld::ProcessLevelStreamingVolumes but for now I think you can leave it as it is. These are two different methods of streaming and I think they are mutually exclusive.