Author Topic: About CalculateRelativeWidgetBounds  (Read 5223 times)

shokinhan

  • Guest
About CalculateRelativeWidgetBounds
« on: September 05, 2012, 01:44:56 AM »
I used the function CalculateRelativeWidgetBounds for two object, but the result has some inaccuracy。

eg:
      Vector3 pos = Vector3.zero;
      Bounds bound = NGUIMath.CalculateRelativeWidgetBounds(_needGuideObj.transform, point.transform);
      pos.x = bound.center.x;
      pos.y = bound.center.y;

shokinhan

  • Guest
Re: About CalculateRelativeWidgetBounds
« Reply #1 on: September 05, 2012, 01:48:53 AM »
I used the function CalculateRelativeWidgetBounds for two object, but the result has some inaccuracy。

eg:
      Vector3 pos = Vector3.zero;
      Bounds bound = NGUIMath.CalculateRelativeWidgetBounds(_needGuideObj.transform, point.transform);
      pos.x = bound.center.x;
      pos.y = bound.center.y;
      GameObject c1 = new GameObject();
      c.transform.localPosition = pos;
   
     But the gameobject C1 position has some inaccuracy. But C1's position is not different from the special gameobject of point at the editor.

dlewis

  • Guest
Re: About CalculateRelativeWidgetBounds
« Reply #2 on: September 05, 2012, 05:16:00 AM »
Try parenting the new gameobject so that it has the same parent as the _needGuildObj then set the position

c1.transform.parent = _needGuideObj.transform
c.transform.localPosition = pos;
« Last Edit: September 05, 2012, 07:00:59 PM by dlewis »