How to get actor compopnent size?

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

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

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

Thank you so much!!

I found this:

And this:

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.

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!!

1 Like

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

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!!

did you try this?

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?

1 Like

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

Thank you very much for your help

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

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

1 Like

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

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!!


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… :butterfly:

Totally worth it, free puzzles for days!

1 Like

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 :laughing:

Best Regards @Everynone :heart:

1 Like

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

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!!

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