# Getting the bounding box of a static mesh collision data

**URL:** <https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619>\
**Category:** World Creation\
**Tags:** bounding-box, unreal-engine, Collision, question\
**Created:** [March 5, 2019, 12:12am UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619 "2019-03-05T00:12:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f3fb80e6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f3fb80e6](https://forums.unrealengine.com/u/anonymous_user_f3fb80e6)\
**Post date:** [March 5, 2019, 12:12am UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/1 "2019-03-05T00:12:06Z")

</div>

I have a static mesh imported into my project, which includes simple and complex collision data. I can see both fine in the UE4 mesh editor. Now I want the bounding box of the simple collision data of a given UStaticMeshComponent in C++. Is there an easy way to achieve this?

---

<div class="post-metadata">

**Author:** ![avinchen111414](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@avinchen111414](https://forums.unrealengine.com/u/avinchen111414)\
**Post date:** [March 5, 2019, 1:26pm UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/2 "2019-03-05T13:26:37Z")

</div>

The collision data is storing @UBodySetup-\>AggGeom

You can access these data through:  
Actor-\>GetStaticMeshComponent()-\>GetBodySetup()-\>AggGeom;

---

<div class="post-metadata">

**Author:** ![avinchen111414](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@avinchen111414](https://forums.unrealengine.com/u/avinchen111414)\
**Post date:** [March 5, 2019, 1:26pm UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/3 "2019-03-05T13:26:44Z")

</div>

The member “BoxElems” is exactly the bounding box data.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f3fb80e6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f3fb80e6](https://forums.unrealengine.com/u/anonymous_user_f3fb80e6)\
**Post date:** [March 5, 2019, 8:16pm UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/4 "2019-03-05T20:16:03Z")

</div>

Ok, that works, thanks. I am doing the following:

FBoxSphereBounds bsBounds;  
StaticMeshComp-\>GetBodySetup()-\>AggGeom.CalcBoxSphereBounds(bsBounds, FTransform());

However, that gives me the bounds at center 0,0,0 - how can I get the correct world space location, what do I have to use as transform?

---

<div class="post-metadata">

**Author:** ![avinchen111414](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@avinchen111414](https://forums.unrealengine.com/u/avinchen111414)\
**Post date:** [March 6, 2019, 3:01am UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/5 "2019-03-06T03:01:32Z")

</div>

Of course you get the bounds at the origin. Cause FTransform(), the default constructor, construct a ZERO translation. The second params of CalcBoxSphereBounds is LocalToWorld transformation.

---

<div class="post-metadata">

**Author:** ![avinchen111414](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@avinchen111414](https://forums.unrealengine.com/u/avinchen111414)\
**Post date:** [March 6, 2019, 3:03am UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/6 "2019-03-06T03:03:28Z")

</div>

Try  
AggGeom-\>CalcBoxSphereBounds(sb, FTransform(FVector(100.0f, 100.0f, 100.0f)));  
You will find the origin of the box is translated to (100.0f, 100.0f, 100.0f)

🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f3fb80e6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f3fb80e6](https://forums.unrealengine.com/u/anonymous_user_f3fb80e6)\
**Post date:** [March 6, 2019, 8:18am UTC](https://forums.unrealengine.com/t/getting-the-bounding-box-of-a-static-mesh-collision-data/444619/7 "2019-03-06T08:18:58Z")

</div>

Ahh I see, that works, thanks a lot!
