# How to get actor compopnent size?

**URL:** <https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930>\
**Category:** Getting Started & Setup\
**Tags:** unreal-engine, CPP, Blueprint, question\
**Created:** [May 3, 2024, 11:23am UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930 "2024-05-03T11:23:46Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 11:23am UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/1 "2024-05-03T11:23:46Z")

</div>

I want to get the size of an actor component (Size in the world).

Basically I want to know the distance between the vertices (yellow circles).  
 ![actor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/3/fc3ab603ea6db05f49ecfe862e35f2be3bfe8274.png)

It looks like there is a function that does this for actors.

> **[AActor::GetActorBounds](https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/GameFramework/AActor/GetActorBounds/)**
>
> Returns the bounding box of all components that make up this Actor (excluding ChildActorComponents).

But I need the size of an actor component.  
Any way to get it?

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 12:07pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/2 "2024-05-03T12:07:11Z")

</div>

I found this:

![](https://d3kjluh73b9h9o.cloudfront.net/optimized/4X/f/2/6/f26e1113135e8b8297f86e4347653b3d87b7545e_2_690x388.jpeg)https://www.youtube.com/embed/4rrgldPmtE8?feature=oembed&wmode=opaque

And this:

```auto
FVector Size = StaticMesh->Bounds.GetBox().GetSize();
FVector BoxExtent = StaticMesh->Bounds.BoxExtent;
FVector Origin = StaticMesh->Bounds.Origin;

```

And this:

`UKismetSystemLibrary::GetComponentBounds(const USceneComponent* Component, FVector& Origin, FVector& BoxExtent, float& SphereRadius);`

However, it seems that the box may be much larger than the component especially if it is rotated it seems that it can give erroneous measurements.

> [@Get Random Point In Bounding Box Problem If Rotated](https://forums.unrealengine.com/t/get-random-point-in-bounding-box-problem-if-rotated/1559921/2):
>
> It’s a pain in the bum, basically slight_smile The bounds calculation is correct, so we need to calculate via a box the doesn’t rotate with the actor, and then correct. I have two components, one that always corrects to zero rotation when I move the actor [image] We need to find the points in the unrotated box, and do a couple of transforms to get the rotated box It works. The random point node gives you world coordinates, not much use here. So we have to make them local, rotat…

Another simpler way to measure the component is welcome. It’s just a cube.  
I need length, height and width. That’s all.

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 1:28pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/3 "2024-05-03T13:28:56Z")

</div>

I found that if I multiply the scale by 50 I get exactly the same measurement as in the world.  
Works even if rotated.

 ![Captura de pantalla 2024-05-03 141630](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/5/c75ceeb31fb168d0371d9f6c73aace32dd3aa7d6.png)

The question is… Each scale unit is equivalent to 50cm in the world? Always?  
That is to say… Is it a constant?  
Or does it change if something changes? if screen resolution is changed for example…  
In short: Can I trust this?

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![KryogenicGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kryogenicgames/32/1201049_2.png) [@KryogenicGames](https://forums.unrealengine.com/u/KryogenicGames)\
**Post date:** [May 3, 2024, 3:04pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/4 "2024-05-03T15:04:19Z")

</div>

did you try this?

> **[Screenshot](https://prnt.sc/Cc9bBVjECw-F)**
>
> Captured with Lightshot

box extend is from origin, so its only half of its size so multiply by 2

Edit: sorry are you looking for actor or component size?

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 3:08pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/5 "2024-05-03T15:08:08Z")

</div>

> [@KryogenicGames](#):
>
> Edit: sorry are you looking for actor or component size?

Yes, what I need is the size of the actor component.

Thank you very much for your help

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 3:37pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/6 "2024-05-03T15:37:38Z")

</div>

Ok, forget the scale factor… it’s not going to work… it depends on the original size of the mesh

> [@Transform Scale : What measurement is this](https://forums.unrealengine.com/t/transform-scale-what-measurement-is-this/570123/2):
>
> The default scale is CM for locations. The scale option refers to the relative scale of the object. So a 2m cube at scale 0.5 would be one m in size.

---

<div class="post-metadata">

**Author:** ![KryogenicGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kryogenicgames/32/1201049_2.png) [@KryogenicGames](https://forums.unrealengine.com/u/KryogenicGames)\
**Post date:** [May 3, 2024, 3:58pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/7 "2024-05-03T15:58:18Z")

</div>

you only have 2 options on component size, it only gives you box or sphere but you said fo you it doesnt work. i think what could work better might be Rams Victory plugin , then you can use vertex points location and do distance between selected points, perhaps that would be good for you

> **[Screenshot](https://prnt.sc/LF5teiR7P7fb)**
>
> Captured with Lightshot

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 5:05pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/9 "2024-05-03T17:05:08Z")

</div>

I’m going to study that!!  
Thank you so much @KryogenicGames ❤

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 5:07pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/10 "2024-05-03T17:07:42Z")

</div>

Hi @Everynone  
I found a bot (spamer) account → @RayanMkadema  
Do you want me to let you know if I find more of them?  
Best regards!!

* * *

> [@RepNotify not working?](https://forums.unrealengine.com/t/repnotify-not-working/1277983/21):
>
> In the olden forums days the very first account post had to be manually mod-approved. The bots have been living under a rock and still think it’s a thing. Sadly, while the manual approval kept most of the spam at bay, it mostly prevented legitimate users from posting the actual question… expressionless I can only wish the previous system was still in place - flag a post to make it immediately hidden. If the user appeals, mods can restore it. Spammers won’t appeal, though. but dont understa…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 3, 2024, 5:38pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/11 "2024-05-03T17:38:12Z")

</div>

Report the post and the user. Hope it matters. And if you report enough of them, the system will ask you to _captcha_ pretty butterflies and other insects… 🦋

Totally worth it, free puzzles for days!

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 5:59pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/12 "2024-05-03T17:59:24Z")

</div>

Ok, I Will

I don’t usually find many of them… This is the second one I see.  
But free puzzles sound good. Maybe I’ll look for them intentionally just for the puzzles 😆

Best Regards @Everynone ❤

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [May 3, 2024, 8:27pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/13 "2024-05-03T20:27:46Z")

</div>

This is the easiest method I have found to measure distances from an actor component (Everything else is a headache).

Step 1: Add Two Scene Component to the Actor

```
UPROPERTY(EditAnywhere, BlueprintReadWrite)
class USceneComponent *Point1;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
class USceneComponent *Point2;

```

Step 2: Subtract the world location module and get its absolute value

```auto
float AMyActor::GetLength() const
{
	if (!IsValid(Point1)) return 0.0f;
	if (!IsValid(Point2)) return 0.0f;	
	return FMath::Abs(Point1->GetComponentLocation().Length() - Point2->GetComponentLocation().Length());
}

```

DONE!!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [June 2, 2024, 8:27pm UTC](https://forums.unrealengine.com/t/how-to-get-actor-compopnent-size/1837930/14 "2024-06-02T20:27:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
