# global way of measuring size of game objects

I’m trying to put a primitive unity cube exactly above the shelf shown in the image (it was taken out of its model) so the equation iam using is box’s position = (shelf’s position.x , shelf’s position.y + (shelf size in y axes /2 ) + ( box’s size in y axes /2 ) , shelf’s postion.z) but neither lossyscale nor local scale return the desired size.

so as shown in the image i want to measure the size of the object relative to the global 1*1 square grid so for the z axes it should return 2 and for the z axes it should return .75 .

Steps-
1)Fill a square grid completely with your box/rectangle so that it accurately fits into the grid.
2)Note the x,y,z scales of the box and set them as the ‘scaleFactor’ for corresponding directions.
E.g-scalefactorX=box.transform.localscale.x.
3)Take your original box that you want take the details of.(not the one that fills the grid to find scalefacors).
4)Now divide the localScale of each axis with the respective scaleFactor, which will return the generalized scale of your box with repect to global grids.
e.g- your desired output should be Vector3(box.transform.localScale.x/scalefactorX,box.transform.localScale.y/scalefactorY,box.transform.localScale.z/scalefactorZ)

P.S.- this approach will give the accurate volume and edges of simple figures like rectangle, cube, cuboids etc. but for complex shapes, you will only get the corresponding localScales of a given game object.