Get Box Extents from construction script?

I’m having some trouble scripting what should be a relatively easy construction script, but I am not able to understand how this works:

So I want to set up some meshes to appear at some certain areas within a box collision component. However, whenever I get the extents, it’s only returning me the default values set in the BP, not the extent values set on the instance in the level, which is causing the results to be useless and unpredictable.

I can’t seem to figure out what I’m doing wrong…

OK - I found a solution:

I created a vector variable and set the extents of the box collision to the vector and then when I retrieve the extents and I get the desired result.

But why doesn’t it just work straight from the object?

Hey same problem here, and i would like to avoid to create a vector variable for this since we could use the box extent variable but it always return the x:32 y:32 z:32 default value in construction script, is thig a bug ?

I’d also be glad to know that, I’m using UE 4.11 preview 6 and encountered same problem. Workaround works fine, but it’s workaround.

Hi,

I had a similar situation for my conveyor actor.
I create a series of meshes to form a conveyor belt and use a flexible volume to move everything inside it.

And this is the function that spawns the meshes and adjusts the volume size.

When you spawn a box volume dynamically, it will always be 32x32 by default. In order to scale it to a desired size, you would need to divide that value by 32x32 and use that as scale values.
As you can see in the graph, Im dividing the overall desired length (Segments * MeshSize.X) by the box extent. If that is 32, or whatever, doesnt matter. The box will alwazs scale correctly.

The FVector BoxExtent is protected so one of the functions GetScaledBoxExtent() or GetUnscaledBoxExtent() should be used to access the value. I believe the box component functions are not firing before the construction script of the actor holding the component so you will get the class defaults.

It would be best to use a variable in the Actor to set the box extent and reference elsewhere or wait until begin play.