I have several composite static objects in the scene, and I use InstancedStaticMesh
within the actors placed. However, I am having trouble obtaining bounding boxes of said actors.
Approximate code:
Actor* actor = GetWorld()->SpawnActor<AActor>(AActor::StaticClass(), GetTransform());
for (UStaticMesh* mesh : mesh_list) {
UInstancedStaticMeshComponent* mesh_component = NewObject<UInstancedStaticMeshComponent>(actor);
mesh_component->RegisterComponent();
mesh_component->SetStaticMesh(mesh);
actor->AddInstanceComponent(mesh_component);
}
FVector actor_origin;
FVector actor_extent;
GetActorBounds(false, actor_origin, actor_extent);
Both actor_origin
and actor_extent
return zeros while calling FBoxSphereBounds
on each of those instanced mesh components yield correct bounds. Even before applying transform, should actor_extent
reflect the union bounding box of all InstancedStaticMesh
components?