FInd the min and max position of children?

Hello,

I have four children to a parent. They all stick together wherever they go. The children are placed on the right, left, up and down with respect to the parent. Due the rotation of the parent, at any point I would like to find the child which occupies the minimum/Maximum X position and the minimum/maximum Z Position among everything.

What is the best way to solve it or is there any in-built Unity3d function which could grant access to find my child position or even compare the position with all the children and find the min and max?

Any help or advice is highly appreciated.

Thank you Devs

GAME : Top-Down View. i.e. along x and z axis.

P.S. :If you devs recommend to keep it simple, first I would like to find the min then.

Can’t test this as I’m currently reimporting all my game assets :frowning: - But this should do it:

    using System.Linq;

    var leftMost = transform.Cast<Transform>().OrderBy(t=>t.position.x).First();
    var topMost = transform.Cast<Transform>().OrderBy(t=>t.position.z).First();