how do i scale an object to fit another object?
i want to scale this white object to fit perfectly on top of those 4 walls.
capture11.png
(296.5 kB)
Comment
we need more information about what your objects are Just gameobjects? With/what meshes? You could make use of the Bounds (e.g. mesh bounds).
And the walls?
If the walls are seperate gameObjects you can easily calculate the size of the cube measuring the distance between the two walls on the same axis. To illustrate:
float z = (wallTop.transform.positon.z - wallBottom.transform.position.z);
flaot x = (wallRight.transform.position.x - wallLeft.transform.position.x);
cube.transform.localScale = new Vector3(x, 1, z);
Your answer
