-- Main
---- Content
------ A
------ ScrollView
------- Element
---------- B
我需要使用項目中的Tween接口將A物體運動到B物體位置。如上述,因為Tween接口只支持anchoredPosition,那么在不擴展接口的情況下,我們需要獲取B物體在Content下的局部坐標。
//獲取B的世界坐標
Vector3 wp = B.transform.TransformPoint(Vector3.Zero);
//將wp坐標轉換到Content的局部坐標下
Vector3 lp = Content.transform.InverseTransformPoint(wp)