Ivan3z
(Ivan3z)
May 3, 2024, 11:23am
1
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).
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!!
Ivan3z
(Ivan3z)
May 3, 2024, 12:07pm
2
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.
It’s a pain in the bum, basically
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
[image]
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!!
1 Like
Ivan3z
(Ivan3z)
May 3, 2024, 1:28pm
3
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
Ivan3z
(Ivan3z)
May 3, 2024, 3:08pm
5
Yes, what I need is the size of the actor component.
Thank you very much for your help
Ivan3z
(Ivan3z)
May 3, 2024, 3:37pm
6
Ok, forget the scale factor… it’s not going to work… it depends on the original size of the mesh
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.
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
Ivan3z
(Ivan3z)
May 3, 2024, 5:05pm
9
I’m going to study that!!
Thank you so much @KryogenicGames
Ivan3z
(Ivan3z)
May 3, 2024, 5:07pm
10
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!!
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…
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…
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!
1 Like
Ivan3z
(Ivan3z)
May 3, 2024, 5:59pm
12
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
1 Like
Ivan3z
(Ivan3z)
May 3, 2024, 8:27pm
13
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!!
system
(system)
Closed
June 2, 2024, 8:27pm
14
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.