Hello,
While debugging performance issues with Chaos in our project we noticed that a movable actor was dirtying the static TAABBTree. The actor is fully movable and all of its components are set to movable.
Upon closer inspection we found that this movable actor had an ISM component, which was also set to movable, however the instance bodies were still registered in the static tree, and not the dynamic tree.
Tracking this down, this seems to come from UInstancedStaticMeshComponent::CreateAllInstanceBodies, specifically
Instance->InitBody(BodySetup, InstanceTM, this, PhysScene, nullptr );
The nullptr being passed in into the implicit constructor sets the bStaticPhysics inside the FInitBodySpawnParams to true, because it’s nullptr.
When we change the InitBody to pass in “this” instead, it seems to work as intended and the bodies are part of the dynamic tree.
It mostly seems like this would be a bug because the function is specifically checking Mobility == EComponentMobility::Movable before initializing the body.
To this I have two questions:
Can you confirm whether this is an oversight/bug or if this is somehow intentional?
And secondly, should ISM components, where we expect to be moving the instances with UpdateInstanceTransform, be set to movable, even when the component itself is unlikely to move? If the above is really a bug, then with this change I would expect that ISM components that are likely to move its bodies are better off to be set to movable to avoid dirtying the static tree all the time.
Thank you for your time,
Kind regards,
Céleste Neukirchen