I am looking for a way to find all actors within our world partition, included nested level instances, that fall within a given bounding box. I can do this already IF all the actors I am interested in have their collision turned on. This is done using:
unreal.SystemLibrary.component_overlap_actors(volume, volume.get_world_transform(), object_types, unreal.Actor, [])
The hitch here, obviously, is the requirement that all of the actors have collision turned on. A second approach is to traverse the full list of actor descriptions like:
actor_descs = unreal.WorldPartitionBlueprintLibrary.get_actor_descs()
for actor_desc in actor_descs:
mesh_min_bounds = actor_desc.bounds.min
mesh_max_bounds = actor_desc.bounds.max
# check overlap with the volume bounds
if check_overlap(volume, mesh_min_bounds, mesh_max_bounds):
overlapped_actors.append(actor_desc)
But there is a downside here as well. I can find no way to get from an FActorDesc to an AActor.
I should mention I have gone a full 12 rounds with the Epic dev AI and have gotten no where. It will talk you in a circle and eventually come to the conclusion “Now that we have a list of FActorDesc you just need to convert those to AActor and you are done” which, funnily enough, is exactly what I was asking it to do!
I have also tried
UWorldPartitionEditorHash::FForEachIntersectingActorParams ForEachIntersectingActorParams = UWorldPartitionEditorHash::FForEachIntersectingActorParams();
WorldPartition->EditorHash->ForEachIntersectingActor(QueryBox,
[&OverlappingActors, &QueryBox](const FWorldPartitionActorDescInstance* ActorDescInstance)
{
FBox ActorBounds = ActorDescInstance->GetEditorBounds();
if (ActorBounds.Intersect(QueryBox))
{
OverlappingActors.Add(ActorDescInstance->GetActor());
}
return true; // continue iteration
}, ForEachIntersectingActorParams);
But this only iterates over the loaded actors. It seems like the default values in FForEachIntersectingActorParams should ignore whether something is spatially loaded or not, but it only traverses the loaded actors.
In conclusion, it seems that component_overlap_actors() is able to traverse everything in the world, loaded or not, just fine. If I can be pointed at how to do this I am happy to do all the bounds checking myself. Or, since get_actor_descs() will give me every actor in the world as an FActor I’d accept a way to get from that to an AActor as well. Maybe there is an iterator in the code somewhere that will iterate all actors, loaded or not, in all next level instances, and is in a form I can get an AActor from it?
I am happy to have a python or c++ answer. I can wrap whatever you provide to give my pipeline code access via python anyway.
[Attachment Removed]