public Vector3 WholeFloorCenter(Transform transform_)
{
Transform parent = transform_;
Vector3 center = Vector3.zero;
if (parent.childCount > 0)
{
for (int i = 0; i < parent.childCount; i++)
{
center += parent.GetChild(i).position;
}
center /= parent.childCount;
return center;
}
else
{
return Vector3.zero;
}
}
网友评论