DrawAALine() 공개 정적인 메소드

public static DrawAALine ( Vector3 start, Vector3 end ) : void
start Vector3
end Vector3
리턴 void
예제 #1
0
        public new void OnSceneGUI()
        {
            SliderJoint2D sliderJoint2D = (SliderJoint2D)this.target;

            if (!sliderJoint2D.enabled)
            {
                return;
            }
            Vector3 vector  = Joint2DEditor.TransformPoint(sliderJoint2D.transform, sliderJoint2D.anchor);
            Vector3 vector2 = vector;
            Vector3 vector3 = vector;
            Vector3 vector4 = Joint2DEditor.RotateVector2(Vector3.right, -sliderJoint2D.angle - sliderJoint2D.transform.eulerAngles.z);

            Handles.color = Color.green;
            if (sliderJoint2D.useLimits)
            {
                vector2 = vector + vector4 * sliderJoint2D.limits.max;
                vector3 = vector + vector4 * sliderJoint2D.limits.min;
                Vector3 a  = Vector3.Cross(vector4, Vector3.forward);
                float   d  = HandleUtility.GetHandleSize(vector2) * 0.16f;
                float   d2 = HandleUtility.GetHandleSize(vector3) * 0.16f;
                Joint2DEditor.DrawAALine(vector2 + a * d, vector2 - a * d);
                Joint2DEditor.DrawAALine(vector3 + a * d2, vector3 - a * d2);
            }
            else
            {
                vector4 *= HandleUtility.GetHandleSize(vector) * 0.3f;
                vector2 += vector4;
                vector3 -= vector4;
            }
            Joint2DEditor.DrawAALine(vector2, vector3);
            base.OnSceneGUI();
        }
예제 #2
0
        public void OnSceneGUI()
        {
            TargetJoint2D target = (TargetJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 vector  = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
                Vector3 vector2 = (Vector3)target.target;
                Handles.color = Color.green;
                Handles.DrawDottedLine(vector, vector2, 5f);
                if (base.HandleAnchor(ref vector, false))
                {
                    Undo.RecordObject(target, "Move Anchor");
                    target.anchor = Joint2DEditor.InverseTransformPoint(target.transform, vector);
                }
                float   num     = HandleUtility.GetHandleSize(vector2) * 0.3f;
                Vector3 vector3 = (Vector3)(Vector3.left * num);
                Vector3 vector4 = (Vector3)(Vector3.up * num);
                Joint2DEditor.DrawAALine(vector2 - vector3, vector2 + vector3);
                Joint2DEditor.DrawAALine(vector2 - vector4, vector2 + vector4);
                if (base.HandleAnchor(ref vector2, true))
                {
                    Undo.RecordObject(target, "Move Target");
                    target.target = vector2;
                }
            }
        }
        public void OnSceneGUI()
        {
            RelativeJoint2D target1 = (RelativeJoint2D)this.target;

            if (!target1.enabled)
            {
                return;
            }
            Vector3 target2   = (Vector3)target1.target;
            Vector3 vector3_1 = !(bool)((Object)target1.connectedBody) ? Vector3.zero : target1.connectedBody.transform.position;

            Handles.color = Color.green;
            Joint2DEditor.DrawAALine(target2, vector3_1);
            float   num1      = HandleUtility.GetHandleSize(vector3_1) * 0.16f;
            Vector3 vector3_2 = Vector3.left * num1;
            Vector3 vector3_3 = Vector3.up * num1;

            Joint2DEditor.DrawAALine(vector3_1 - vector3_2, vector3_1 + vector3_2);
            Joint2DEditor.DrawAALine(vector3_1 - vector3_3, vector3_1 + vector3_3);
            float   num2      = HandleUtility.GetHandleSize(target2) * 0.16f;
            Vector3 vector3_4 = Vector3.left * num2;
            Vector3 vector3_5 = Vector3.up * num2;

            Joint2DEditor.DrawAALine(target2 - vector3_4, target2 + vector3_4);
            Joint2DEditor.DrawAALine(target2 - vector3_5, target2 + vector3_5);
        }
예제 #4
0
        public void OnSceneGUI()
        {
            SliderJoint2D target = (SliderJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 position = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
                Vector3 vector2  = position;
                Vector3 vector3  = position;
                Vector3 lhs      = (Vector3)Joint2DEditor.RotateVector2(Vector3.right, -target.angle - target.transform.eulerAngles.z);
                Handles.color = Color.green;
                if (target.useLimits)
                {
                    vector2 = position + ((Vector3)(lhs * target.limits.max));
                    vector3 = position + ((Vector3)(lhs * target.limits.min));
                    Vector3 vector5 = Vector3.Cross(lhs, Vector3.forward);
                    float   num     = HandleUtility.GetHandleSize(vector2) * 0.16f;
                    float   num2    = HandleUtility.GetHandleSize(vector3) * 0.16f;
                    Joint2DEditor.DrawAALine(vector2 + ((Vector3)(vector5 * num)), vector2 - ((Vector3)(vector5 * num)));
                    Joint2DEditor.DrawAALine(vector3 + ((Vector3)(vector5 * num2)), vector3 - ((Vector3)(vector5 * num2)));
                }
                else
                {
                    lhs      = (Vector3)(lhs * (HandleUtility.GetHandleSize(position) * 0.3f));
                    vector2 += lhs;
                    vector3 -= lhs;
                }
                Joint2DEditor.DrawAALine(vector2, vector3);
                base.OnSceneGUI();
            }
        }
        public void OnSceneGUI()
        {
            HingeJoint2D target = (HingeJoint2D)base.target;

            if (target.enabled)
            {
                if (target.useLimits)
                {
                    Vector3 position = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
                    float   num      = Mathf.Min(target.limits.min, target.limits.max);
                    float   num2     = Mathf.Max(target.limits.min, target.limits.max);
                    float   angle    = num2 - num;
                    float   radius   = HandleUtility.GetHandleSize(position) * 0.8f;
                    float   rotation = target.GetComponent <Rigidbody2D>().rotation;
                    Vector3 from     = (Vector3)Joint2DEditor.RotateVector2(Vector3.right, -num2 - rotation);
                    Vector3 end      = position + ((Vector3)(Joint2DEditor.RotateVector2(Vector3.right, -target.jointAngle - rotation) * radius));
                    Handles.color = new Color(0f, 1f, 0f, 0.7f);
                    Joint2DEditor.DrawAALine(position, end);
                    Handles.color = new Color(0f, 1f, 0f, 0.03f);
                    Handles.DrawSolidArc(position, Vector3.back, from, angle, radius);
                    Handles.color = new Color(0f, 1f, 0f, 0.7f);
                    Handles.DrawWireArc(position, Vector3.back, from, angle, radius);
                    this.DrawTick(position, radius, 0f, from, 1f);
                    this.DrawTick(position, radius, angle, from, 1f);
                }
                base.OnSceneGUI();
            }
        }
예제 #6
0
        public new void OnSceneGUI()
        {
            HingeJoint2D hingeJoint2D = (HingeJoint2D)base.target;

            if (hingeJoint2D.enabled)
            {
                if (hingeJoint2D.useLimits)
                {
                    Vector3 vector   = Joint2DEditor.TransformPoint(hingeJoint2D.transform, hingeJoint2D.anchor);
                    float   num      = Mathf.Min(hingeJoint2D.limits.min, hingeJoint2D.limits.max);
                    float   num2     = Mathf.Max(hingeJoint2D.limits.min, hingeJoint2D.limits.max);
                    float   angle    = num2 - num;
                    float   num3     = HandleUtility.GetHandleSize(vector) * 0.8f;
                    float   rotation = hingeJoint2D.GetComponent <Rigidbody2D>().rotation;
                    Vector3 vector2  = Joint2DEditor.RotateVector2(Vector3.right, -num2 - rotation);
                    Vector3 end      = vector + Joint2DEditor.RotateVector2(Vector3.right, -hingeJoint2D.jointAngle - rotation) * num3;
                    Handles.color = new Color(0f, 1f, 0f, 0.7f);
                    Joint2DEditor.DrawAALine(vector, end);
                    Handles.color = new Color(0f, 1f, 0f, 0.03f);
                    Handles.DrawSolidArc(vector, Vector3.back, vector2, angle, num3);
                    Handles.color = new Color(0f, 1f, 0f, 0.7f);
                    Handles.DrawWireArc(vector, Vector3.back, vector2, angle, num3);
                    this.DrawTick(vector, num3, 0f, vector2, 1f);
                    this.DrawTick(vector, num3, angle, vector2, 1f);
                }
                base.OnSceneGUI();
            }
        }
        public void OnSceneGUI()
        {
            TargetJoint2D targetJoint2D = (TargetJoint2D)base.target;

            if (targetJoint2D.enabled)
            {
                Vector3 vector  = Joint2DEditor.TransformPoint(targetJoint2D.transform, targetJoint2D.anchor);
                Vector3 vector2 = targetJoint2D.target;
                Handles.color = Color.green;
                Handles.DrawDottedLine(vector, vector2, 5f);
                if (base.HandleAnchor(ref vector, false))
                {
                    Undo.RecordObject(targetJoint2D, "Move Anchor");
                    targetJoint2D.anchor = Joint2DEditor.InverseTransformPoint(targetJoint2D.transform, vector);
                }
                float   d  = HandleUtility.GetHandleSize(vector2) * 0.3f;
                Vector3 b  = Vector3.left * d;
                Vector3 b2 = Vector3.up * d;
                Joint2DEditor.DrawAALine(vector2 - b, vector2 + b);
                Joint2DEditor.DrawAALine(vector2 - b2, vector2 + b2);
                if (base.HandleAnchor(ref vector2, true))
                {
                    Undo.RecordObject(targetJoint2D, "Move Target");
                    targetJoint2D.target = vector2;
                }
            }
        }
예제 #8
0
        public void OnSceneGUI()
        {
            TargetJoint2D target1 = (TargetJoint2D)this.target;

            if (!target1.enabled)
            {
                return;
            }
            Vector3 position = Joint2DEditor.TransformPoint(target1.transform, (Vector3)target1.anchor);
            Vector3 target2  = (Vector3)target1.target;

            Handles.color = Color.green;
            Handles.DrawDottedLine(position, target2, 5f);
            if (this.HandleAnchor(ref position, false))
            {
                Undo.RecordObject((Object)target1, "Move Anchor");
                target1.anchor = (Vector2)Joint2DEditor.InverseTransformPoint(target1.transform, position);
            }
            float   num       = HandleUtility.GetHandleSize(target2) * 0.3f;
            Vector3 vector3_1 = Vector3.left * num;
            Vector3 vector3_2 = Vector3.up * num;

            Joint2DEditor.DrawAALine(target2 - vector3_1, target2 + vector3_1);
            Joint2DEditor.DrawAALine(target2 - vector3_2, target2 + vector3_2);
            if (!this.HandleAnchor(ref target2, true))
            {
                return;
            }
            Undo.RecordObject((Object)target1, "Move Target");
            target1.target = (Vector2)target2;
        }
        public new void OnSceneGUI()
        {
            HingeJoint2D target = (HingeJoint2D)this.target;

            if (!target.enabled)
            {
                return;
            }
            if (target.useLimits)
            {
                Vector3 vector3_1 = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
                float   num1      = Mathf.Min(target.limits.min, target.limits.max);
                float   num2      = Mathf.Max(target.limits.min, target.limits.max);
                float   angle     = num2 - num1;
                float   radius    = HandleUtility.GetHandleSize(vector3_1) * 0.8f;
                float   rotation  = target.GetComponent <Rigidbody2D>().rotation;
                Vector3 vector3_2 = (Vector3)Joint2DEditor.RotateVector2((Vector2)Vector3.right, -num2 - rotation);
                Vector3 end       = vector3_1 + (Vector3)(Joint2DEditor.RotateVector2((Vector2)Vector3.right, -target.jointAngle - rotation) * radius);
                Handles.color = new Color(0.0f, 1f, 0.0f, 0.7f);
                Joint2DEditor.DrawAALine(vector3_1, end);
                Handles.color = new Color(0.0f, 1f, 0.0f, 0.03f);
                Handles.DrawSolidArc(vector3_1, Vector3.back, vector3_2, angle, radius);
                Handles.color = new Color(0.0f, 1f, 0.0f, 0.7f);
                Handles.DrawWireArc(vector3_1, Vector3.back, vector3_2, angle, radius);
                this.DrawTick(vector3_1, radius, 0.0f, vector3_2, 1f);
                this.DrawTick(vector3_1, radius, angle, vector3_2, 1f);
            }
            base.OnSceneGUI();
        }
예제 #10
0
        public void OnSceneGUI()
        {
            RelativeJoint2D relativeJoint2D = (RelativeJoint2D)this.target;

            if (!relativeJoint2D.enabled)
            {
                return;
            }
            Vector3 vector  = relativeJoint2D.target;
            Vector3 vector2 = (!relativeJoint2D.connectedBody) ? Vector3.zero : relativeJoint2D.connectedBody.transform.position;

            Handles.color = Color.green;
            Joint2DEditor.DrawAALine(vector, vector2);
            float   d  = HandleUtility.GetHandleSize(vector2) * 0.16f;
            Vector3 b  = Vector3.left * d;
            Vector3 b2 = Vector3.up * d;

            Joint2DEditor.DrawAALine(vector2 - b, vector2 + b);
            Joint2DEditor.DrawAALine(vector2 - b2, vector2 + b2);
            float   d2 = HandleUtility.GetHandleSize(vector) * 0.16f;
            Vector3 b3 = Vector3.left * d2;
            Vector3 b4 = Vector3.up * d2;

            Joint2DEditor.DrawAALine(vector - b3, vector + b3);
            Joint2DEditor.DrawAALine(vector - b4, vector + b4);
        }
예제 #11
0
        public static void DrawDistanceGizmo(Vector3 anchor, Vector3 connectedAnchor, float distance)
        {
            Vector3 normalized = (anchor - connectedAnchor).normalized;
            Vector3 end        = connectedAnchor + normalized * distance;
            Vector3 vector3    = Vector3.Cross(normalized, Vector3.forward) * (HandleUtility.GetHandleSize(connectedAnchor) * 0.16f);

            Handles.color = Color.green;
            Joint2DEditor.DrawAALine(anchor, end);
            Joint2DEditor.DrawAALine(connectedAnchor + vector3, connectedAnchor - vector3);
            Joint2DEditor.DrawAALine(end + vector3, end - vector3);
        }
예제 #12
0
        public new void OnSceneGUI()
        {
            WheelJoint2D wheelJoint2D = (WheelJoint2D)base.target;

            if (wheelJoint2D.enabled)
            {
                Vector3 vector  = Joint2DEditor.TransformPoint(wheelJoint2D.transform, wheelJoint2D.anchor);
                Vector3 vector2 = vector;
                Vector3 vector3 = vector;
                Vector3 vector4 = Joint2DEditor.RotateVector2(Vector3.right, -wheelJoint2D.suspension.angle - wheelJoint2D.transform.eulerAngles.z);
                Handles.color = Color.green;
                vector4      *= HandleUtility.GetHandleSize(vector) * 0.3f;
                vector2      += vector4;
                vector3      -= vector4;
                Joint2DEditor.DrawAALine(vector2, vector3);
                base.OnSceneGUI();
            }
        }
예제 #13
0
        public void OnSceneGUI()
        {
            WheelJoint2D target = (WheelJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 position = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
                Vector3 start    = position;
                Vector3 end      = position;
                Vector3 vector4  = (Vector3)Joint2DEditor.RotateVector2(Vector3.right, -target.suspension.angle - target.transform.eulerAngles.z);
                Handles.color = Color.green;
                vector4       = (Vector3)(vector4 * (HandleUtility.GetHandleSize(position) * 0.3f));
                start        += vector4;
                end          -= vector4;
                Joint2DEditor.DrawAALine(start, end);
                base.OnSceneGUI();
            }
        }
예제 #14
0
        public new void OnSceneGUI()
        {
            WheelJoint2D target = (WheelJoint2D)this.target;

            if (!target.enabled)
            {
                return;
            }
            Vector3 position  = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
            Vector3 vector3_1 = position;
            Vector3 vector3_2 = position;
            Vector3 vector3_3 = (Vector3)Joint2DEditor.RotateVector2((Vector2)Vector3.right, -target.suspension.angle - target.transform.eulerAngles.z);

            Handles.color = Color.green;
            Vector3 vector3_4 = vector3_3 * (HandleUtility.GetHandleSize(position) * 0.3f);

            Joint2DEditor.DrawAALine(vector3_1 + vector3_4, vector3_2 - vector3_4);
            base.OnSceneGUI();
        }
예제 #15
0
        public void OnSceneGUI()
        {
            RelativeJoint2D target = (RelativeJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 start = (Vector3)target.target;
                Vector3 end   = (target.connectedBody == null) ? Vector3.zero : target.connectedBody.transform.position;
                Handles.color = Color.green;
                Joint2DEditor.DrawAALine(start, end);
                float   num     = HandleUtility.GetHandleSize(end) * 0.16f;
                Vector3 vector3 = (Vector3)(Vector3.left * num);
                Vector3 vector4 = (Vector3)(Vector3.up * num);
                Joint2DEditor.DrawAALine(end - vector3, end + vector3);
                Joint2DEditor.DrawAALine(end - vector4, end + vector4);
                float   num2    = HandleUtility.GetHandleSize(start) * 0.16f;
                Vector3 vector5 = (Vector3)(Vector3.left * num2);
                Vector3 vector6 = (Vector3)(Vector3.up * num2);
                Joint2DEditor.DrawAALine(start - vector5, start + vector5);
                Joint2DEditor.DrawAALine(start - vector6, start + vector6);
            }
        }
예제 #16
0
        public new void OnSceneGUI()
        {
            SliderJoint2D target = (SliderJoint2D)this.target;

            if (!target.enabled)
            {
                return;
            }
            Vector3 position  = Joint2DEditor.TransformPoint(target.transform, (Vector3)target.anchor);
            Vector3 vector3_1 = position;
            Vector3 vector3_2 = position;
            Vector3 lhs       = (Vector3)Joint2DEditor.RotateVector2((Vector2)Vector3.right, -target.angle - target.transform.eulerAngles.z);

            Handles.color = Color.green;
            Vector3 vector3_3;
            Vector3 vector3_4;

            if (target.useLimits)
            {
                vector3_3 = position + lhs * target.limits.max;
                vector3_4 = position + lhs * target.limits.min;
                Vector3 vector3_5 = Vector3.Cross(lhs, Vector3.forward);
                float   num1      = HandleUtility.GetHandleSize(vector3_3) * 0.16f;
                float   num2      = HandleUtility.GetHandleSize(vector3_4) * 0.16f;
                Joint2DEditor.DrawAALine(vector3_3 + vector3_5 * num1, vector3_3 - vector3_5 * num1);
                Joint2DEditor.DrawAALine(vector3_4 + vector3_5 * num2, vector3_4 - vector3_5 * num2);
            }
            else
            {
                Vector3 vector3_5 = lhs * (HandleUtility.GetHandleSize(position) * 0.3f);
                vector3_3 = vector3_1 + vector3_5;
                vector3_4 = vector3_2 - vector3_5;
            }
            Joint2DEditor.DrawAALine(vector3_3, vector3_4);
            base.OnSceneGUI();
        }