Download

How to scale actor to properly match size in float?

I have to resize an actor (TriggerBox) but using the same float I’m using to define locations doesn’t work.
So how can I properly rescale a triggerbox to match a group of other actors scale?

hi , not this is not what I need, because in my case we have the size in float variable and we need to resize the triggerbox based on it.
But if i do that using the size (bounds) of other actors the triggerbox is much more wider.

If you’re using a single float, then you won’t be able to fit the box since a box has 3 extents (x, y, z).
Can you show a picture of what you have so far?

oh sorry, I’ve just close the Engine.
However I have set of actors which they are 1000 size x,y,z (like a box).
I have to rescale a triggerbox to embrace many of these, so 50 actors means 50,000 size unit,
so how can I rescale a triggerbox to 50,000 size unit?

Using GetActorArrayBounds will do just that for you. It takes in all actors you want to enclose, and outputs the box’s location and extents. Then, set the world location of the TriggerBox to “Center” and the BoxExtent of the TriggerBox to “BoxExtent”; that will “scale” it for you automatically. Also, if all the actors together form a cube, you only need to use the actors at the corners.

Also, you’ve basically already answered you’re question here. You’ve already solved the size of the box, so the position of the box is just the center of all the actors, which you get by averaging all their positions. The GetActorArrayBounds does all of this for you automatically.

2 Likes

Thank you Midgunner, I’ve been using GetActorArrayBounds in different scenarios. Ive been reading your answer carefully, I think you’re right. So let me try it. The system I’ve created may vary based on few factors but I think I wouldn’t face ani problem in get the bounds… ok so I just have to try.
Thank you very much, I’m following your example