- Home /
Does renderer.bounds of Parent GameObject include all children meshes that are rendered?
Does renderer.bounds of Parent GameObject include all children meshes that are rendered?
As in, will the parent renderer.bounds be equal to the sum of all the children renderer.bounds
Answer by whydoidoit · Oct 16, 2013 at 09:36 AM
Do you mean if there are sub meshes - then yes, if you mean things which appear as a hierarchy in the scene then no. If you want to get the bounds of an item and its children:
Bounds bounds = renderer.bounds;
foreach(var r in GetComponentsInChildren<Renderer>())
{
bounds.Encapsulate(r.bounds);
}
Not sure if you would say they are sub meshes or things in hierarchy... They are meshes grouped together in modeling software, but if brought into unity they would also be the same in hierarchy. So... not sure..?
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
Child object of another GameObject invisible or inactive @ runtime 2 Answers
Creating new Transform from existing objects Transform to Instantiate object 1 Answer
How can I get a parent GameObject of gameObject using Javascript? 6 Answers
Access a child from the parent or other gameObject. 2 Answers