# How do you convert scales to units and vice versa?

I’m not quite sure I understand the problem.

I’m guessing you have a door static mesh model and you have applied a scale to it which is not [1,1,1]? I’ll make this assumption.

Lets say you have a cube which is centered on the origin. The cube has 8 vertices to mark its corners, and they’re at:
{100,100,100}
{-100,100,100}
{100,-100,100}
{100,100,-100}
{-100,-100,100}
{100,-100,-100}
{-100,100,-100}
{-100,-100,-100}

These vertices are in object space. When you create the cube within a 3D modeling program, it exports these values as vertices. When you put this cube mesh into your game, the object vertices get placed into world space.
If your object is centered on [0,0,0] within the game world, the vertices will match the object space vertices, right?

Well, it doesn’t do anyone much good to keep objects centered at the world origin position, so we apply various transformations to the object. If you apply a translation of 100 units along the X axis, we add 100 to the X components of each vertex in the cube. If we apply a rotation of 45 degrees around the X axis, we apply that by using sine and cosine for each vertex position. If we apply a ‘scale’ of 2 along the X axis for our mesh, we go through and multiply each X component in each vertex by 2, such that {100,100,100} becomes {200,100,100} and {-100,100,100} becomes {-200,100,100}.

So, with this in mind, if you want to find the scaled size of a static mesh, you need to know a few things:

1. What is the native size of the mesh?
2. What is the scale transform?
3. Where is the origin?

In the case of this cube, the native size is a 200x200x200 cube. If we scale it by 2, it becomes a 400x400x400 cube. If we scale it by 0.5, it becomes a 100x100x100 cube. etc. etc.

For your door, you just need to know its native size and the scale, and you can get the scaled size of the door in world units. I would almost bet that there’s a node which does this for you…

I’m trying to randomly place a door and randomly place a wall around it. I’ve made a box trigger to indicate the area in which I want the door to appear. I have a complicated blueprint that uses a combination of bound, box extents, and break vectors to figure out the Y area in which I want to randomly place my doors.

That works.

Now, I need to build walls around it. Unfortunately, this seems to mean I have to constantly convert from units to scales to transform the wall boxes. Is there a simple way to do this? Is there a better way to tackle this problem? I’m having regular issues converting scales to units and vice versa. I would like to be working only in units, if there was a way to do that.

I’ve attached a picture to demonstrate my predicament.