Esempio n. 1
0
        //trans = the transform where path is relative to, null if path is already in world position
        private static void DrawPathHelper(Transform trans, Vector3[] path, Color color, string method)
        {
            //Line Draw:
            Vector3 prevPt = trans != null?trans.localToWorldMatrix.MultiplyPoint(AMUtil.Interp(path, 0)) : AMUtil.Interp(path, 0);

            Gizmos.color = color;
            int SmoothAmount = path.Length * 20;

            for (int i = 1; i <= SmoothAmount; i++)
            {
                float   pm     = (float)i / SmoothAmount;
                Vector3 currPt = AMUtil.Interp(path, pm);
                if (trans != null)
                {
                    currPt = trans.localToWorldMatrix.MultiplyPoint(currPt);
                }
                if (method == "gizmos")
                {
                    Gizmos.DrawLine(currPt, prevPt);
                }
                else if (method == "handles")
                {
                    Debug.LogError("AMTween Error: Drawing a path with Handles is temporarily disabled because of compatability issues with Unity 2.6!");
                    //UnityEditor.Handles.DrawLine(currPt, prevPt);
                }
                prevPt = currPt;
            }
        }