I would like to know the coordinates of the left and right side of the actor, within the Y axis.

Hi!

I’m trying to understand how GetActorBounds works. To do it I have this actor:

It consists of two static meshes of 50x50x50.

The pivot point is on the middle of the left cube. The distance of each face is 25. And the location of the actor in world is (0, 25, 800).

When I run this code:

FVector BoxExtend;
FVector Origin;|
GetActorBounds(true, Origin, BoxExtend);

I get these values:

Which I don’t understand. In particular, the value of Origin.Y. Is the Origin value a world space location?

And also, the box extend. Why the value of Y is 50? I think it should be 100.

I would like to know the coordinates of the left and right side of the actor, within the Y axis. The ones I’ve surrounded with a yellow ellipse.

Thank you!

You are going to have to do some extra work to get the bounds depending on the actor rotation. I’m guessing you’ll want the left and right side no matter the orientation of the actor. If you just use actor bounds then once you start rotating the actor for instance 45 deg you will no longer get the side of the meshes

You would probably need to rely on get local bounds with some extra steps like shown here

The extent only has half of the distance so 50 and not a 100 because it’s extending from the origin (the center of the actor in this case). Think of it like the radius of a circle. It’s not the distance from edge to edge but from the origin to the side of the bounding box.

Something like this:


The centers of the debug boxes are the oriented points of the extremes of the mesh

Further changes in the code would depends on the use case. Are you rotating your components or scaling them etc.


For the full actor left and right:

Because the bounding box is not oriented you have to temporarily set the rotation to zero to get the bounds => cache it => revert rotation and then rotate the vector to get the final output

Simplified to just a function call:

1 Like