コード例 #1
0
ファイル: Extensions.cs プロジェクト: spikar1/SteffenTools
        /// <summary>
        /// Draw an arc from pos1 to pos2.
        /// </summary>
        /// <param name="pos1"></param>
        /// <param name="pos2"></param>
        /// <param name="color"></param>
        /// <param name="heightScale">The apex of the arc</param>
        /// <param name="duration"></param>
        public static void DrawArc(Vector3 pos1, Vector3 pos2, Color color, float heightScale = 1, float duration = 0)
        {
            int divisions = 15;

            Vector3 prevPos = pos1;

            for (int j = 0; j <= divisions; j++)
            {
                Vector3 pos = Vector3Extensions.GetPointAlongArc(
                    pos1,
                    pos2,
                    Mathf.Repeat((float)j / divisions, divisions),
                    heightScale);
                Debug.DrawLine(prevPos, pos, color, duration);
                prevPos = pos;
            }
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: spikar1/SteffenTools
        /// <summary>
        /// Draws an arc from pos1 to pos2
        /// </summary>
        /// <param name="pos1"></param>
        /// <param name="pos2"></param>
        /// <param name="heightScale">how tall the apex of the arc should be</param>
        public static void DrawArc(Vector3 pos1, Vector3 pos2, float heightScale = 1)
        {
            Color c = Gizmos.color;

            int divisions = 15;

            //Gizmos.color = new Color(c.r, c.g, c.b, .1f);
            Vector3 prevPos = pos1;

            for (int i = 0; i <= divisions; i++)
            {
                Vector3 pos = Vector3Extensions.GetPointAlongArc(
                    pos1,
                    pos2,
                    Mathf.Repeat((float)i / divisions, divisions),
                    heightScale);
                Gizmos.DrawLine(prevPos, pos);
                prevPos = pos;
            }
            Gizmos.color = c;
        }