Hi guys…i am having number of cubes which are dynamically placed by a script and i want to show them in perfectly in center…means i can place cubes in a manner that they could be 3 by 3 or 4 by 4 or any other matrix…so now what i want is that i have to show them perfectly in center so how could i do that??? any help will be much appreciated Thanks a lot in Advance…if providing script then please use c#…Thanks again…

  1. to find the center point of many items:

add them all up. and then divide by the number of items.

So if you have ten items it is ( A1 + A2 + A3 … + A10 ) / 10.0

Note that the simplest example of this is: if you need the middle point between two things, it’s (A+B)/2.0.

If you have all your items in an array: use a for loop to add them all up and then divide by the count. Unless we know exactly how you handle the items, it’s hard to help you with that.

  1. now you the the central position, CP, of all the items.

quite simply, use “LookAt” on your camera, with CP, to make the camera look at CP.

Hope it helps.