# GetActorBounds affected by rotation

**URL:** <https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [November 18, 2015, 7:12pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940 "2015-11-18T19:12:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![TiagoLing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TiagoLing](https://forums.unrealengine.com/u/TiagoLing)\
**Post date:** [November 18, 2015, 7:12pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/1 "2015-11-18T19:12:20Z")

</div>

I’m using GetActorBounds to create a bounding sphere around my actor. I get the box extents and use it to find the box diagonal and use that as the radius for a SphereCollision.

Everything works fine, but when i rotate my actor it affects the results of GetActorBounds, changing the radius of the sphere for any rotation values different from 0, 90, 180 and 270.

My question is: how can i get the actor bounds ignoring its rotation?

Thanks!

---

<div class="post-metadata">

**Author:** ![AsleepMacaw7384](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AsleepMacaw7384](https://forums.unrealengine.com/u/AsleepMacaw7384)\
**Post date:** [May 10, 2016, 3:01pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/2 "2016-05-10T15:01:06Z")

</div>

have you solve this? i have the same question.

---

<div class="post-metadata">

**Author:** ![TiagoLing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TiagoLing](https://forums.unrealengine.com/u/TiagoLing)\
**Post date:** [May 10, 2016, 3:08pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/3 "2016-05-10T15:08:46Z")

</div>

I didn’t solve it, but i used a workaround:

- Set your desired Actor rotation
- GetActorBounds with this rotation
- Store the result inside a variable
- Use this cached bounds value to avoid the changes in bounds with rotation.

This is not ideal though, since not all actors are perfectly square or spherical you might want to add some offsets to the cached bounds to cover the actor in all rotations.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Yasja\_de\_Miranda](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yasja\_de\_Miranda](https://forums.unrealengine.com/u/Yasja_de_Miranda)\
**Post date:** [May 12, 2016, 11:36am UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/4 "2016-05-12T11:36:02Z")

</div>

Be aware that the Extent of a box changes if you rotate it’s contents: it is calculated from the center to the most distanced point, but stays a box. When I applied the box extent of a component to a collisionbox size and rotated the collisionbox to the world rotation of the actor, it kept pretty good measure. This applies to sphere collisions too.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [May 18, 2017, 5:54am UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/5 "2017-05-18T05:54:21Z")

</div>

If you just need a rough sphere you can try GetSimpleCollisionRadius() [AActor::GetSimpleCollisionRadius | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/GetSimpleCollisionRadius/index.html)

---

<div class="post-metadata">

**Author:** ![Homer\_Xing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Homer\_Xing](https://forums.unrealengine.com/u/Homer_Xing)\
**Post date:** [September 17, 2018, 1:29pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/6 "2018-09-17T13:29:18Z")

</div>

unfortunately `AActor::GetActorBounds` is affected by rotation.

For getting actor bounding box and not affected by actor rotation, choose `AActor::CalculateComponentsBoundingBoxInLocalSpace` function

---

<div class="post-metadata">

**Author:** ![Elou44](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/elou44/32/738751_2.png) [@Elou44](https://forums.unrealengine.com/u/Elou44)\
**Post date:** [July 9, 2021, 12:16am UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/7 "2021-07-09T00:16:05Z")

</div>

It seems that `AActor::CalculateComponentsBoundingBoxInLocalSpace` is also affected by rotation (tested on UE4.26).

---

<div class="post-metadata">

**Author:** ![maxrevilo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@maxrevilo](https://forums.unrealengine.com/u/maxrevilo)\
**Post date:** [October 17, 2021, 6:42pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/8 "2021-10-17T18:42:01Z")

</div>

It did work for me in UE4.26. It’s not affected by the actor rotation, but it’s affected by the components’ local rotation.

Then inside that function, it uses `USceneComponent::CalcBounds(const FTransform& LocalToWorld)` which is pretty interesting for anyone working with bounds that are not Axis Aligned.

---

<div class="post-metadata">

**Author:** ![nejo.quol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nejo.quol](https://forums.unrealengine.com/u/nejo.quol)\
**Post date:** [March 10, 2024, 3:39pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/9 "2024-03-10T15:39:22Z")

</div>

I know it is old, but in case someone needs the answer:

```auto
void UYourClass::GetComponentOrientedBoundingBox(USceneComponent* Component, FVector& Origin, FVector& Extent)
{
	// Calculate the right world origin
	FVector ComponentExtent;
	float ComponentRadius;
	UKismetSystemLibrary::GetComponentBounds(Component, Origin, ComponentExtent, ComponentRadius);

	// Calculate the right extent
	auto Box = Component->GetOwner()->CalculateComponentsBoundingBoxInLocalSpace(); 
	Extent = Box.GetExtent();
}

```

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/a/eba52dceacbe2ab52db050b2c8e9108774869913.png)

---

<div class="post-metadata">

**Author:** ![macxike](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@macxike](https://forums.unrealengine.com/u/macxike)\
**Post date:** [June 21, 2024, 9:09am UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/10 "2024-06-21T09:09:59Z")

</div>

I can not find the node “GetComponentOrientedBoundingBox”. How do I find/create it? Thanks

---

<div class="post-metadata">

**Author:** ![rhomita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rhomita/32/642479_2.png) [@rhomita](https://forums.unrealengine.com/u/rhomita)\
**Post date:** [August 25, 2024, 6:47pm UTC](https://forums.unrealengine.com/t/getactorbounds-affected-by-rotation/338940/11 "2024-08-25T18:47:57Z")

</div>

You need to create the function GetComponentOrientedBoundingBox by adding the c++ code that you can see in the comment above in order to use it as a node in the blueprints.  
The function CalculateComponentsBoundingBoxInLocalSpace exists in the Actor class but it is not exposed to blueprints.
