# I want 2 vectors representing the bounds of a mesh but when I rotate the actor, the bounds are wrong when the object rotates

**URL:** <https://forums.unrealengine.com/t/i-want-2-vectors-representing-the-bounds-of-a-mesh-but-when-i-rotate-the-actor-the-bounds-are-wrong-when-the-object-rotates/361687>\
**Category:** Community & Industry Discussion\
**Tags:** math, rotation, box, unreal-engine, question, vectors\
**Created:** [June 22, 2016, 12:48pm UTC](https://forums.unrealengine.com/t/i-want-2-vectors-representing-the-bounds-of-a-mesh-but-when-i-rotate-the-actor-the-bounds-are-wrong-when-the-object-rotates/361687 "2016-06-22T12:48:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_00981c62](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_00981c62](https://forums.unrealengine.com/u/anonymous_user_00981c62)\
**Post date:** [June 22, 2016, 12:48pm UTC](https://forums.unrealengine.com/t/i-want-2-vectors-representing-the-bounds-of-a-mesh-but-when-i-rotate-the-actor-the-bounds-are-wrong-when-the-object-rotates/361687/1 "2016-06-22T12:48:21Z")

</div>

I’m currently trying to make a board, where I can drag objects along a flat plane. I also want this actor modular, so I’m allowing user’s to replace the existing mesh and use another.

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/8/08f960cc4e9265bdcf8976441eb01bdbac0d45fe.png)  
I get the bounds of the component, to get the min and the max vectors to make a _box_. When an objects is dragged, it’s location will be limited between those two vectors.

My problem is, whenever I rotate the actor, the the component bound vectors that are found aren’t the corners of the mesh.

The diamonds are the points found.  
Here’s at yaw 0

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/8/480c52e11041ab60ba2d7b69118c2680b5bd7238.jpeg)  
Here’s at Yaw 90

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/a/0a5fe1dd3182c1a01c41c8c43d7ed99c2dbae6dc.jpeg)  
I’ve tried using rotate around axis, but nothing I do seems to fix this problem

---

<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:38pm UTC](https://forums.unrealengine.com/t/i-want-2-vectors-representing-the-bounds-of-a-mesh-but-when-i-rotate-the-actor-the-bounds-are-wrong-when-the-object-rotates/361687/2 "2024-03-10T15:38:32Z")

</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/2/d/7/2d78e153e012a3cd4374f4c8858f47b2a417ffde.png)
