TransformPoint() 보호된 정적인 메소드

protected static TransformPoint ( Transform transform, Vector3 position ) : Vector3
transform UnityEngine.Transform
position Vector3
리턴 Vector3
예제 #1
0
        public new void OnSceneGUI()
        {
            HingeJoint2D hingeJoint2D = (HingeJoint2D)this.target;

            if (!hingeJoint2D.enabled)
            {
                return;
            }
            if (hingeJoint2D.useLimits)
            {
                Vector3 vector   = Joint2DEditorBase.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  = Joint2DEditorBase.RotateVector2(Vector3.right, -num2 - rotation);
                Vector3 end      = vector + Joint2DEditorBase.RotateVector2(Vector3.right, -hingeJoint2D.jointAngle - rotation) * num3;
                Handles.color = new Color(0f, 1f, 0f, 0.7f);
                Joint2DEditorBase.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();
        }
예제 #2
0
        public void OnSceneGUI()
        {
            HingeJoint2D target = (HingeJoint2D)this.target;

            if (target.enabled)
            {
                if (target.useLimits)
                {
                    Vector3 position = Joint2DEditorBase.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)Joint2DEditorBase.RotateVector2(Vector3.right, -num2 - rotation);
                    Vector3 end      = position + ((Vector3)(Joint2DEditorBase.RotateVector2(Vector3.right, -target.jointAngle - rotation) * radius));
                    Handles.color = new Color(0f, 1f, 0f, 0.7f);
                    Joint2DEditorBase.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();
            }
        }
예제 #3
0
        public new void OnSceneGUI()
        {
            SliderJoint2D sliderJoint2D = (SliderJoint2D)this.target;

            if (!sliderJoint2D.enabled)
            {
                return;
            }
            Vector3 vector  = Joint2DEditorBase.TransformPoint(sliderJoint2D.transform, sliderJoint2D.anchor);
            Vector3 vector2 = vector;
            Vector3 vector3 = vector;
            Vector3 vector4 = Joint2DEditorBase.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;
                Joint2DEditorBase.DrawAALine(vector2 + a * d, vector2 - a * d);
                Joint2DEditorBase.DrawAALine(vector3 + a * d2, vector3 - a * d2);
            }
            else
            {
                vector4 *= HandleUtility.GetHandleSize(vector) * 0.3f;
                vector2 += vector4;
                vector3 -= vector4;
            }
            Joint2DEditorBase.DrawAALine(vector2, vector3);
            base.OnSceneGUI();
        }
예제 #4
0
        public void OnSceneGUI()
        {
            this.anchorJoint2D = (AnchoredJoint2D)this.target;
            Vector3 position        = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.transform, (Vector3)this.anchorJoint2D.anchor);
            Vector3 connectedAnchor = (Vector3)this.anchorJoint2D.connectedAnchor;

            if (this.anchorJoint2D.connectedBody != null)
            {
                connectedAnchor = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.connectedBody.transform, connectedAnchor);
            }
            Vector3 vector4 = connectedAnchor - position;
            Vector3 vector3 = position + ((Vector3)((vector4.normalized * HandleUtility.GetHandleSize(position)) * 0.1f));

            Handles.color = Color.green;
            Vector3[] points = new Vector3[] { vector3, connectedAnchor };
            Handles.DrawAAPolyLine(points);
            if (base.HandleAnchor(ref connectedAnchor, true))
            {
                connectedAnchor = Joint2DEditorBase.SnapToPoint(this.SnapToSprites(connectedAnchor), position, 0.13f);
                if (this.anchorJoint2D.connectedBody != null)
                {
                    connectedAnchor = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.connectedBody.transform, connectedAnchor);
                }
                Undo.RecordObject(this.anchorJoint2D, "Move Connected Anchor");
                this.anchorJoint2D.connectedAnchor = connectedAnchor;
            }
            if (base.HandleAnchor(ref position, false))
            {
                position = Joint2DEditorBase.SnapToPoint(this.SnapToSprites(position), connectedAnchor, 0.13f);
                Undo.RecordObject(this.anchorJoint2D, "Move Anchor");
                this.anchorJoint2D.anchor = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.transform, position);
            }
        }
예제 #5
0
        public void OnSceneGUI()
        {
            SliderJoint2D target = (SliderJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 position = Joint2DEditorBase.TransformPoint(target.transform, (Vector3)target.anchor);
                Vector3 vector2  = position;
                Vector3 vector3  = position;
                Vector3 lhs      = (Vector3)Joint2DEditorBase.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;
                    Joint2DEditorBase.DrawAALine(vector2 + ((Vector3)(vector5 * num)), vector2 - ((Vector3)(vector5 * num)));
                    Joint2DEditorBase.DrawAALine(vector3 + ((Vector3)(vector5 * num2)), vector3 - ((Vector3)(vector5 * num2)));
                }
                else
                {
                    lhs      = (Vector3)(lhs * (HandleUtility.GetHandleSize(position) * 0.3f));
                    vector2 += lhs;
                    vector3 -= lhs;
                }
                Joint2DEditorBase.DrawAALine(vector2, vector3);
                base.OnSceneGUI();
            }
        }
예제 #6
0
        public void OnSceneGUI()
        {
            SpringJoint2D target = (SpringJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 anchor          = Joint2DEditorBase.TransformPoint(target.transform, (Vector3)target.anchor);
                Vector3 connectedAnchor = (Vector3)target.connectedAnchor;
                if (target.connectedBody != null)
                {
                    connectedAnchor = Joint2DEditorBase.TransformPoint(target.connectedBody.transform, connectedAnchor);
                }
                Joint2DEditorBase.DrawDistanceGizmo(anchor, connectedAnchor, target.distance);
                base.OnSceneGUI();
            }
        }
예제 #7
0
        public void OnSceneGUI()
        {
            WheelJoint2D target = (WheelJoint2D)this.target;

            if (target.enabled)
            {
                Vector3 position = Joint2DEditorBase.TransformPoint(target.transform, (Vector3)target.anchor);
                Vector3 start    = position;
                Vector3 end      = position;
                Vector3 vector4  = (Vector3)Joint2DEditorBase.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;
                Joint2DEditorBase.DrawAALine(start, end);
                base.OnSceneGUI();
            }
        }
        public new void OnSceneGUI()
        {
            DistanceJoint2D distanceJoint2D = (DistanceJoint2D)this.target;

            if (!distanceJoint2D.enabled)
            {
                return;
            }
            Vector3 anchor = Joint2DEditorBase.TransformPoint(distanceJoint2D.transform, distanceJoint2D.anchor);
            Vector3 vector = distanceJoint2D.connectedAnchor;

            if (distanceJoint2D.connectedBody)
            {
                vector = Joint2DEditorBase.TransformPoint(distanceJoint2D.connectedBody.transform, vector);
            }
            Joint2DEditorBase.DrawDistanceGizmo(anchor, vector, distanceJoint2D.distance);
            base.OnSceneGUI();
        }
예제 #9
0
        public new void OnSceneGUI()
        {
            WheelJoint2D wheelJoint2D = (WheelJoint2D)this.target;

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

            Handles.color = Color.green;
            vector4      *= HandleUtility.GetHandleSize(vector) * 0.3f;
            vector2      += vector4;
            vector3      -= vector4;
            Joint2DEditorBase.DrawAALine(vector2, vector3);
            base.OnSceneGUI();
        }
        public void OnSceneGUI()
        {
            this.anchorJoint2D = (AnchoredJoint2D)this.target;
            Vector3 vector  = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.transform, this.anchorJoint2D.anchor);
            Vector3 vector2 = this.anchorJoint2D.connectedAnchor;

            if (this.anchorJoint2D.connectedBody)
            {
                vector2 = Joint2DEditorBase.TransformPoint(this.anchorJoint2D.connectedBody.transform, vector2);
            }
            Vector3 vector3 = vector + (vector2 - vector).normalized * HandleUtility.GetHandleSize(vector) * 0.1f;

            Handles.color = Color.green;
            Handles.DrawAAPolyLine(new Vector3[]
            {
                vector3,
                vector2
            });
            if (base.HandleAnchor(ref vector2, true))
            {
                vector2 = this.SnapToSprites(vector2);
                vector2 = Joint2DEditorBase.SnapToPoint(vector2, vector, 0.13f);
                if (this.anchorJoint2D.connectedBody)
                {
                    vector2 = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.connectedBody.transform, vector2);
                }
                Undo.RecordObject(this.anchorJoint2D, "Move Connected Anchor");
                this.anchorJoint2D.connectedAnchor = vector2;
            }
            if (base.HandleAnchor(ref vector, false))
            {
                vector = this.SnapToSprites(vector);
                vector = Joint2DEditorBase.SnapToPoint(vector, vector2, 0.13f);
                Undo.RecordObject(this.anchorJoint2D, "Move Anchor");
                this.anchorJoint2D.anchor = Joint2DEditorBase.InverseTransformPoint(this.anchorJoint2D.transform, vector);
            }
        }