コード例 #1
0
        public static void DrawArc(Vector3 center, Vector3 from, Vector3 normal, float angle, float radius, int numSegments, Color color, bool depthTest = true)
        {
            if (numSegments <= 0)
            {
                return;
            }

            from.Normalize();
            from *= radius;

            var aVert = new Vector3[numSegments + 1];

            aVert[0] = center + from;

            float      numSegmentsInv = 1.0f / numSegments;
            Quaternion rotStep        = QuaternionUtil.AxisAngle(normal, angle * numSegmentsInv);
            Vector3    vec            = rotStep * from;

            for (int i = 1; i <= numSegments; ++i)
            {
                aVert[i] = center + vec;
                vec      = rotStep * vec;
            }

            DrawLineStrip(aVert, color, depthTest);
        }
コード例 #2
0
ファイル: DrawArc.cs プロジェクト: SuomiKP31/Project-Impetus
        protected override void Draw(Color color, DebugUtil.Style style, bool depthTest)
        {
            Quaternion startRot = QuaternionUtil.AxisAngle(Vector3.forward, StartAngle * MathUtil.Deg2Rad);

            DebugUtil.DrawArc
            (
                transform.position,
                transform.rotation * startRot * Vector3.right,
                transform.rotation * Vector3.forward,
                ArcAngle * MathUtil.Deg2Rad, Radius, NumSegments,
                color, depthTest
            );
        }