We are building a level just like the titan level of God of War 3 https://www.youtube.com/watch?v=eGjFDsTYF3c, we build the level for each body part under a pivot actor via attach and attach the pivot root actors to each bone of the titan skeletal mesh component at runtime at BeginPlay. And manage the details by data layers. This works great at first, but while the project growing up, the total of attached actors get about 50k, we’re getting some performance issue on updating the transforms of those child actors even if they are far away and unseen from the player.
[Image Removed]
So we’re wondering can we utilze world partition to manage those moving actors somehow?
However as we know, the moving objects will get loaded and unloaded with their cells which is determined while starting PIE or cooking.
And due to the attaching hierarchy, the child actors would use their parent bounds to get streamed in. But we see there is Sub-World Partition introduced by UE5.4, so we thought by converting those leaf child actors of the same body part into level instance and use the standalone level behavior may probably solve this issue? (But it seems the actors inside level instance do not follow the transform of LevelInstance actor)
But To address the moving objects partition issue, the first approach comes to our mind is
Can we project the real streaming source onto the original cells like this?
[Image Removed]
Or can we update the streaming cells at runtime, update the involved cell positions with the body parts just like how the pivot actors get attached to the bones?
We are trying to figure out what could be a best practice to make the world partition work with such objects moving with body parts but which are statically relative to the owning body parts.
Sounds like you have solution, then? If the above works for you and you just need to make some setters public, send us the list in this ticket and we can make them official.
Indeed the default world partition levels are static, but since the meshes on the same body part are static in the bone space so we believe there are some workarounds or hacks to utilize WP on such moving parts.
And we found a half way workaround via:
Convert all the actors on the same body part into LevelInstance with Level Behaviour set to standalone and enable streaming to use Sub-World Partition
We made a new component which spawns a new pivot actor in the sub-level and attach all the actors of LI onto it, and make it to follow the bone transform just like how ULevelInstanceComponent and ALevelInstanceEditorInstanceActor did in the editor world. We also try to forward the bone’s world transform to the UWorldPartition::InstanceTransform to trick the WP’s streaming source calculating. But unfortunately, the public setter of InstanceTransform is editor only. So we might choose to modify the engine code or project the original streaming sources into the sub-levels.
But we have faced an issue, since the streaming is on so we can’t attach all the sub-level actors onto the pivot actor when the LI actor is loaded since all the sub streaming levels are not ready yet. So we have to listen the FLevelStreamingDelegates::OnLevelStreamingStateChanged, and attach the actors of the activated cell onto their corresponding pivot actor. But the issue is we can’t identify which level instance this sub-world partition streaming level belongs to. There are some identifiers but all of them are editor only.