GetActorBounds ignores child actor components & instanced meshes

I hope these images speak for themselves: (bounding box is visualised by box trace)

Ignored 5 instanced static meshes when calculating actor bounds:
74744-
Child actor components are also ignored:
74745-
It looks like child actor components and instanced meshes are not considered as a part of an actor somewhere in the process, because there is a bug with “Merge Actors” tool that also ignores child actor components and instanced meshes: https://answers.unrealengine.com/questions/357688/merge-actors-2-bugs.html
… So that might be a clue for this bug.

Hello ,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Could you elaborate on this issue and explain how the result you are receiving is at an inverse to the result that you would expect?
  2. Can you reproduce this issue in a clean project?
  3. Could you provide screen shots on any blueprints/code that may be involved?

Yes, it can be reproduced in new, clean project by adding Child Actor Component into a blueprint (for example by using “Add Child Actor Component” in Construction Script) and checking actor bounds by GetActorBounds node. Bounds can be visualised by e.g. performing a Box Trace with Start & End set to ‘Origin’ output and Half Size set to GetActorBounds’ “Box Extent”.

74971-notitle2.jpg

Any added Child Actor Component will be not taken into account when calculating actor bounds. Same for instanced static meshes.

The apple on the image is a Child Actor Component, while threee other objects are Static Mesh Components. It doesn’t take the apple into account when calculating actor bounds. On the left is what bounding box looks like, on the right - what it should look like (so it treats the apple as a part of the actor, just like these three other meshes)

I was able to reproduce this issue on our end. I have written up a report (UE-25749) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Note: You could get the bounds for the child actor. I have added an example below.

75279-childactorboundshelp.png

Make it a great day

I have a very similar issue, which I posted back in June 2015 and have still had no official response.

I assume this is the same bug?

Hello Kenomica,

I took a quick look at the issue that you linked in your last comment. It appears as though these could be related. I will be sure to bump up the community interest for this issue.

Thanks for the response. I really hope so, since this issue has been delaying the release of my game for a long time now.

I’m glad it’s been seen!

Any further news with this?

Hello Kenomica,

After taking another look at the report, it appears that the status has been updated. This functionality is working as intended.

In case anyone still wants this:

void AYourAmazingActor::GetBoundsIncludingChildActors(bool bOnlyCollidingComponents, FVector& Origin, FVector& BoxExtent) const
{
	FBox Bounds = GetComponentsBoundingBox(!bOnlyCollidingComponents);
	TArray<UActorComponent*> ChildActorComponents = GetComponentsByClass(UChildActorComponent::StaticClass());
	for (UActorComponent* ChildActorComponent : ChildActorComponents)
	{
		const AActor* ChildActor = Cast<UChildActorComponent>(ChildActorComponent)->GetChildActor();
		if (IsValid(ChildActor))
		{
			Bounds += ChildActor->GetComponentsBoundingBox(!bOnlyCollidingComponents);
		}
	}
	Bounds.GetCenterAndExtents(Origin, BoxExtent);
}
2 Likes