I was looking for a place in ACesium3DTileset where i can catch newly created gltf components to do some processing on them only once. I stumbled on applyActorCollisionSettings() that has the following comment above it:
/**
* @brief Applies the actor collision settings for a newly created glTF
* component
*
* TODO Add details here what that means
* @param BodyInstance ...
* @param Gltf ...
*/
This to me sounds like it should process the gltf component once after its creation, but this function gets called every frame for visible components (see ACesium3DTileset::showTilesToRender()). Am I missing something or does this function run more than it needs it?
The comment is definitely wrong. It’s called for every visible tile, every frame, as you’ve discovered. This is perhaps excessive, but it’s also fast, and it ensures runtime changes to tileset collision settings apply to individual tiles in a timely manner.
Unfortunately, I don’t think we have any sort of “new tile” callback in Cesium for Unreal. We do have one in Cesium for Unity, though:
It was added in this PR, which is pretty simple. So perhaps you or someone else from the community are willing and able to bring a similar mechanism over to Unreal?
This issue covers the need for such a callback, as well as unload, show, and hide callbacks. It also has some more details about how it can be implemented:
Thanks for confirming @Kevin_Ring. I got by for my use case by overriding OnChildAttached() in UCesiumGltfComponent, since I need the USceneComponents anyway and this functions behaves the same way.