Finding front center of renderer.bounds

Hello again everyone!
Bakos133 here.

I am trying to find the front center of a dynamically adjustable group of objects.

For example,
The script I am using adjusts the center of a group of game objects dynamically as you build upon it.
(row of 3 blocks, center is 2nd block, row of 4 blocks center is between 2nd and 3rd block, etc.)

What I need to do is find the FRONT CENTER(aka the max.z) of this group of objects and instantiate an object offset on the z axis a little.

The code:

function Start () {


function Update () 
	var combinedBounds = renderer.bounds;
	var renderers = GetComponentsInChildren(Renderer);
	for (var render : Renderer in renderers) 
    	if (render != renderer) combinedBounds.Encapsulate(render.bounds);

The code I am using currently sets the bounding box in the center of my created object, but it is printing the “bounds.max.z” of the empty game object I am using as a parent.

If you guys can help me figure this out, it would be greatly appretiated!

So once again, I am having troubles finding is:

  1. Positive z axis of object

  2. Center of positive z axis


I think this may be what you’re looking for. Additionally, it visualizes the point that you want as a Gizmo.

#pragma strict

var boundsForwadPoint : Vector3;

function Update()

function EncapsulateAll()
    var combinedBounds = new Bounds();
    var renderers = GetComponentsInChildren(typeof(Renderer));
    for (var renderer : Renderer in renderers)
        if (renderer != this.renderer)
	boundsForwadPoint = + new Vector3(0, 0, combinedBounds.max.z);
function OnDrawGizmos()
	Gizmos.DrawSphere(boundsForwadPoint, 0.25);