Created
August 18, 2011 12:49
-
-
Save AngryAnt/1153991 to your computer and use it in GitHub Desktop.
Getting the total rendering bounds of a hierarchy of renderers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Bounds bounds; | |
void Start () | |
{ | |
bounds = new Bounds (transform.position, Vector3.one); | |
Renderer[] renderers = GetComponentsInChildren<Renderer> (); | |
foreach (Renderer renderer in renderers) | |
{ | |
bounds.Encapsulate (renderer.bounds); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment