Difference between Box Extent and Scale in Box Collider

While following this tutorial, I realized that the coin that was supposed to spawn in a random point in a box collider was just spawning in a small box around its center. I found this was because its Box Extent, which I used for generating these random points, did not scale with the collider. To solve it in code, I used the node “Get Scaled Box Extent”.

However, after searching around I couldn’t find the explanation as to why Box Extent didn’t scale with the Box Collider’s Transform Scale, and what was the difference between the two. If you could tell me, I would appreciate it.

PS: Is the Blueprint Scripting the correct section to post this in?

The box extent is the real size in unreal units of your box. For instance a new box will always have a 100100100 size. The scale however is a multiplication of this size by some tri-dimensional factor. This can be useful when you want a single object to have multiple iteration existing with different sizes but it’s not super practical.
I would recommend to always keep your scaling to 1 (base size) unless you have to change it for technical purpose. In case you want to have several iterations of a single object with different sizes I’d also recommend that you put in an editable vector variable that you use to set the extent of your box via the construction script.

I hope this answer can help you solve your issues.

Ps: if you work in code I would advise that you post with the c++ tag instead of blueprint. However if you work with both blueprints and code just post in any category you want depending of what you think is the most relevant for your question.

1 Like