# How can you get the center of actor/component when the pivot is off center?

**URL:** <https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629>\
**Category:** Asset Creation\
**Tags:** origin, unreal-engine, bounds, UE4, question\
**Created:** [January 1, 2017, 11:17am UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629 "2017-01-01T11:17:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SbingBong](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SbingBong](https://forums.unrealengine.com/u/SbingBong)\
**Post date:** [January 1, 2017, 11:17am UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/1 "2017-01-01T11:17:11Z")

</div>

I know there’s getcomponentbounds, getimportedbounds, etc., but I’m at a loss for ideas to get a mesh’s dimensions or center (which those functions imply to be able to do) when the pivot/mesh origin is not at the center of the mesh. This surprises me, because even in the example project for third person, the skeletal mesh’s pivot is offset (it’s at the bottom of the mesh). I can’t find any details either of what direction it measures the box extent from/to when it measures from the pivot location. I would love it if someone could help or provide some clarity.

---

<div class="post-metadata">

**Author:** ![SbingBong](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SbingBong](https://forums.unrealengine.com/u/SbingBong)\
**Post date:** [January 1, 2017, 11:27am UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/2 "2017-01-01T11:27:30Z")

</div>

I believe I found it now… center of mass function should allow me to correct the pivot location as well to get the correct bounds size. I will post back if it works out, unless someone has a simpler solution.

---

<div class="post-metadata">

**Author:** ![SbingBong](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SbingBong](https://forums.unrealengine.com/u/SbingBong)\
**Post date:** [January 1, 2017, 1:02pm UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/3 "2017-01-01T13:02:53Z")

</div>

It seems to be working, but it’s not ideal, here’s how I have it set up right now: center of mass to a variable on begin play → origin - CoM - worldLocation + box extent. Seems to be more reliable but it comes to around 1.09x the size it should be, or really 0.545x (box extent should be half size) I have no clue if I did it right but it’s provided useable results in 3 different meshes.

---

<div class="post-metadata">

**Author:** ![Bob3DGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob3DGames](https://forums.unrealengine.com/u/Bob3DGames)\
**Post date:** [September 23, 2018, 2:16pm UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/4 "2018-09-23T14:16:18Z")

</div>

As far as I can tell, the GetComponentBounds and GetActorBounds nodes return an ‘Origin’ vector which is the centre of a box that encloses the input component or actor.

I would think the centre of mass would be a different location from the centre of the bounding box if the mesh isn’t symmetrical in every axis, which might be why you’re not quite getting half of what the box extent should be.

What I’m doing is to use GetActorBounds on an actor that’s attached to an empty parent static mesh. If I subtract the ‘Origin’ vector from the parent’s location, this moves the child so that the centre of the its mesh (rather than its pivot) is at the pivot of the parent. I can then rotate the parent and the child appears to rotate about its centre rather than its own pivot.

I’m not sure why these nodes don’t provide what you need.

---

<div class="post-metadata">

**Author:** ![UnrealHorrorDev](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealHorrorDev](https://forums.unrealengine.com/u/UnrealHorrorDev)\
**Post date:** [August 28, 2020, 7:40pm UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/5 "2020-08-28T19:40:17Z")

</div>

I think this might not have been around 2 years ago when the question was asked. But now you can get the center like so

```
    FVector Min;
    FVector Max;

Mesh->GetLocalBounds(Min, Max);

FVector BoxCenter = FVector((Max.X + Min.X)/2, (Max.Y + Min.Y)/2, (Max.Z + Min.Z)/2);

```

Get Box extents if you want this way

```
float XMaxVal = FMath::Max(FMath::Abs(Min.X), Max.X) - BoxCenter.X;
float YMaxVal = FMath::Max(FMath::Abs(Min.Y), Max.Y) - BoxCenter.Y;
float ZMaxVal = FMath::Max(FMath::Abs(Min.Z), Max.Z) - BoxCenter.Z;

FVector BoxExtents = FVector(XMaxVal, YMaxVal, ZMaxVal);
```

---

<div class="post-metadata">

**Author:** ![Moo\_Chung](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moo\_Chung](https://forums.unrealengine.com/u/Moo_Chung)\
**Post date:** [March 30, 2022, 2:53am UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/6 "2022-03-30T02:53:29Z")

</div>

Acotr.GetActorBounds(True,False)

---

<div class="post-metadata">

**Author:** ![fxmagnusson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fxmagnusson](https://forums.unrealengine.com/u/fxmagnusson)\
**Post date:** [September 13, 2023, 7:03am UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/7 "2023-09-13T07:03:51Z")

</div>

![MeshCenter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/a/6/8a67a46761235e7947bdd61554e839edc43f13eb.jpeg)

Thank you @UnrealHorrorDev !  
Here’s what the code looks like in blueprints 🙂

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [January 14, 2024, 2:59pm UTC](https://forums.unrealengine.com/t/how-can-you-get-the-center-of-actor-component-when-the-pivot-is-off-center/380629/8 "2024-01-14T14:59:54Z")

</div>

Try this

 ![meshCenterLoc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/e/fbe106a0e7209beed36fd3ba6ad54ba8e88fd914.jpeg)  
The pivot point is off-centered  
 ![meshCenterLoc2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/5/1/b517b177e634ab858aa883d7458642cd9e40be79.jpeg)
