- Home /
How can we get the size of a scaled game object?
How can we get the size of a scaled game object? I tried using transform.renderer.bounds.size
and didn't give me the correct results because, the game object is scaled.
Actually renderer.bounds does give you world coordinates (including scaling), but the bounding box is axis aligned to the world axes. In order to answer your question, you will need to be specific about what size you are looking for. If you know the original size of the object when it has a scale of (1,1,1), then you can use the 'transform.localScale' to deter$$anonymous$$e the current size for x,y,z.
Answer by oliver-jones · May 12, 2014 at 02:03 PM
I don't know if I fully understand, but you can use:
transform.localScale
If your objects scale is 4, 4, 4, your localScale will be 4, 4, 4.
Also, you can get the scale of the parent of that object:
parent.trasform.localScale
If your object is 1, 1, 1 but the parent is 4, 4, 4, then the lcoalScale will be 4, 4, 4
Answer by yoyo696 · Sep 01, 2015 at 08:52 PM
I don't know if I fully understand, but you can use:
transform.localScale
If your objects scale is 4, 4, 4, your localScale will be 4, 4, 4.
Also, you can get the scale of the parent of that object:
parent.trasform.localScale
If your object is 1, 1, 1 but the parent is 4, 4, 4, then the lcoalScale will be 4, 4, 4 I'm trying repeat the same thing to see what will happen.Thanks