示例#1
0
    static void drawPointerGizmos(MeshBuilder mb, GizmoType gizmoType, bool withNormals)
    {
        for (int i = 0; i < mb.PointerCount; ++i)
        {
            Transform trans     = mb.getPointerAt(i);
            bool      chosen    = System.Array.IndexOf(Selection.objects, trans.gameObject) >= 0;
            bool      highlight = gizmoType == GizmoType.Selected || chosen;

            GUIStyle style = new GUIStyle();
            style.normal.textColor = highlight ? Color.white : new Color(1, 1, 1, 0.3f);
            style.fontSize         = chosen ? 14 : 10;
            style.fontStyle        = chosen ? FontStyle.Bold : FontStyle.Normal;

            Handles.Label(trans.position, i.ToString(), style);

            float dotScale = highlight ? 0.02f : 0.01f;

            Handles.color = highlight ? new Color(0.3f, 1, 0.3f) : new Color(0.3f, 1, 0.3f, 0.4f);
#if UNITY_2017
            Handles.DotHandleCap(0, trans.position, trans.rotation, HandleUtility.GetHandleSize(trans.position) * dotScale, EventType.Repaint);
#else
            Handles.DotCap(0, trans.position, trans.rotation, HandleUtility.GetHandleSize(trans.position) * dotScale);
#endif

            if (showNormalGizmos && (withNormals || chosen))
            {
                Handles.color = highlight ? new Color(1, 0.6f, 0) : new Color(1, 0.6f, 0, 0.4f);
#if UNITY_2017
                Handles.ArrowHandleCap(0, trans.position, trans.rotation, normalGizmoLengh, EventType.Repaint);
#else
                Handles.ArrowCap(0, trans.position, trans.rotation, normalGizmoLengh);
#endif
            }
        }
    }
示例#2
0
        void OnSceneGUI()
        {
            Handles.ArrowCap(0, Target.Position, Quaternion.LookRotation(Target.Transform.up), HandleUtility.GetHandleSize(Target.Position));

            if (IsActive)
            {
                // Bezier-Handles
                if (Target.Spline.Interpolation == CurvyInterpolation.Bezier)
                {
                    Handles.color = Color.grey;
                    Vector3 handleOut = Target.HandleOutPosition;
                    Vector3 handleIn  = Target.HandleInPosition;

                    EditorGUI.BeginChangeCheck();
                    Vector3 pOut = Handles.PositionHandle(Target.HandleOutPosition, Tools.handleRotation);

                    Handles.CubeCap(0, pOut, Quaternion.identity, HandleUtility.GetHandleSize(Target.HandleOutPosition) * 0.1f);
                    Handles.DrawLine(pOut, Target.Position);

                    Vector3 pIn = Handles.PositionHandle(Target.HandleInPosition, Tools.handleRotation);
                    Handles.CubeCap(0, pIn, Quaternion.identity, HandleUtility.GetHandleSize(Target.HandleInPosition) * 0.1f);
                    Handles.DrawLine(pIn, Target.Position);

                    bool chgOut = Target.HandleOutPosition != pOut;
                    bool chgIn  = Target.HandleInPosition != pIn;

                    if (chgOut || chgIn)
                    {
#if OLD_UNDO
                        Undo.RegisterUndo(Target, "Move Handle");
#else
                        Undo.ClearUndo(Target);
                        Undo.RecordObject(Target, "Move Handle");
#endif
                        if (chgOut)
                        {
                            Target.HandleOutPosition = pOut;
                        }

                        if (chgIn)
                        {
                            Target.HandleInPosition = pIn;
                        }
                    }

                    if (EditorGUI.EndChangeCheck())
                    {
                        Target.Spline.RefreshImmediately(true, true, false);
                        var lcons = Toolbar.GetItem <CurvyEditor.ToolbarItems.TBLengthConstraint>();
                        if (lcons.Enabled && Target.Spline.Length > lcons.MaxSplineLength)
                        {
                            Target.HandleOutPosition = handleOut;
                            Target.HandleInPosition  = handleIn;
                            Target.Spline.RefreshImmediately(true, true, false);
                        }
                    }
                }
            }
            Toolbar.Render();
        }
示例#3
0
    public void DrawStartPos(APAttack.AttackContext context, bool bDraw)
    {
        if (bDraw && !string.IsNullOrEmpty(context.m_anim))
        {
            APCharacterController oController = (APCharacterController)target;
            Vector3 pointPos = oController.transform.TransformPoint(context.m_bulletStartPosition);
            Color   color    = Color.cyan;
            color.a       = 0.5f;
            Handles.color = color;
            Vector3 newPos = Handles.FreeMoveHandle(pointPos, Quaternion.identity, 0.1f, Vector3.zero, Handles.SphereCap);
            if (GUI.changed)
            {
                Undo.RecordObject(oController, "Move Bullet Position");
                context.m_bulletStartPosition = oController.transform.InverseTransformPoint(newPos);

                // mark object as dirty
                EditorUtility.SetDirty(oController);
            }

            // draw direction arrow
            float   fAngle    = Mathf.Deg2Rad * context.m_bulletDirection;
            Vector2 v2MoveDir = new Vector2(Mathf.Cos(fAngle), -Mathf.Sin(fAngle));

            APCharacterMotor oMotor = oController.GetComponent <APCharacterMotor>();
            if (oMotor && ((oMotor.m_faceRight && v2MoveDir.x < 0f) || (!oMotor.m_faceRight && v2MoveDir.x > 0f)))
            {
                v2MoveDir.x = -v2MoveDir.x;
            }

            v2MoveDir = oController.transform.TransformDirection(v2MoveDir);

            Quaternion rot = Quaternion.LookRotation(v2MoveDir);
            Handles.ArrowCap(0, pointPos, rot, 0.5f);
        }
    }
示例#4
0
        public void OnDrawGizmos()
        {
            // Only when selected
            if (!showOnSelected)
            {
                if (UnityEditor.Selection.activeGameObject == this.gameObject)
                {
                    return;
                }
            }

            // Cache transform
            if (_transform == null)
            {
                _transform = transform;
            }

            Handles.color = useDefaultColor ? ApplyAlpha(Handles.xAxisColor, alpha) : color;
            Handles.ArrowCap(0, _transform.transform.position, _transform.transform.rotation * Quaternion.Euler(0, 90, 0), arrowSize);

            Handles.color = useDefaultColor ? ApplyAlpha(Handles.yAxisColor, alpha) : color;
            Handles.ArrowCap(0, _transform.transform.position, _transform.transform.rotation * Quaternion.Euler(-90, 0, 0), arrowSize);

            Handles.color = useDefaultColor ? ApplyAlpha(Handles.zAxisColor, alpha) : color;
            Handles.ArrowCap(0, _transform.transform.position, _transform.transform.rotation, arrowSize);
        }
    void OnSceneGUI(SceneView sceneView)
    {
        var waypoints = target as Waypoints;

        if (waypoints == null)
        {
            return;
        }
        var spoints = serializedObject.FindProperty("points");

        for (var i = 0; i < spoints.arraySize; ++i)
        {
            var spoint   = spoints.GetArrayElementAtIndex(i);
            var waypoint = spoint.vector3Value;

            EditorGUI.BeginChangeCheck();
            var pos = Handles.FreeMoveHandle(waypoint, Quaternion.identity, 0.25f, Vector3.one * 0.25f,
                                             Handles.RectangleCap);
            Handles.Label(new Vector3(pos.x, 0.5f, pos.z), "Point " + i);

            if (EditorGUI.EndChangeCheck())
            {
                Ray   ray   = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                var   plane = new Plane(Vector3.up, Vector3.zero);
                float f;
                plane.Raycast(ray, out f);
                pos = ray.GetPoint(f);

                spoint.vector3Value = pos;
                serializedObject.SetIsDifferentCacheDirty();
                dirty = true;
            }
            else
            {
                if (dirty)
                {
                    serializedObject.ApplyModifiedProperties();
                }
            }
        }

        foreach (var pair in waypoints.pairs)
        {
            if (pair.First == pair.Second)
            {
                continue;
            }

            try {
                var first  = waypoints.points[pair.First];
                var second = waypoints.points[pair.Second];
                Handles.DrawLine(first, second);

                var dir = (second - first).normalized;
                Handles.ArrowCap(0, second - dir * 1.2f, Quaternion.LookRotation(second - first, Vector3.up), 1);
            }
            catch (IndexOutOfRangeException) {
            }
        }
    }
        public void ShowGizmo()
        {
                        #if EX_GIZMO_ON
            Handles.color = GizmoColor;

            Segment2[] s2a = new Segment2[] {
                new Segment2(baseTriangle.V0, baseTriangle.V1),
                new Segment2(baseTriangle.V1, baseTriangle.V2),
                new Segment2(baseTriangle.V2, baseTriangle.V0)
            };

            int sg_idx = 0;
            foreach (Segment2 s in s2a)
            {
                Handles.ArrowCap(0, s.P0, Quaternion.FromToRotation(-Vector3.back, s.P1 - s.P0), 1f);
                Handles.DrawLine((Vector3)s.P0, (Vector3)s.P1);

                GUIStyle gs = new GUIStyle();
                gs.normal.textColor = GizmoColor;
                gs.hover.textColor  = Color.white;

                Handles.Label(s.P0 + (Vector2)GizmoOffset, sg_idx.ToString(), gs);
                sg_idx++;
            }
                        #endif
        }
示例#7
0
    void OnSceneUI(SceneView sceneView)
    {
        if (mHitData != null)
        {
            HitCheckBase hitCheck = mHitData.hitCheckData;
            Vector3      pos      = debugDummy.transform.TransformPoint(mHitData.startPosition) + hitCheck.posOffset;
            Vector3      normal   = debugDummy.transform.up;
            if (mHitData.moveSpeed > 0)
            {
                Vector3 startDir = debugDummy.transform.TransformDirection(mHitData.startDirection.normalized);
                Handles.ArrowCap(0, pos, Quaternion.LookRotation(startDir.normalized), 2f);
            }

            if (hitCheck.shapeType == EHitCheckShape.Fan)
            {
                Vector3 startVec = Quaternion.AngleAxis(-hitCheck.angle * 0.5f, normal) * debugDummy.transform.forward;
                GizmosExtension.DrawFanShapeWithHeight(pos, normal, startVec, hitCheck.angle, hitCheck.radius, hitCheck.height);
            }
            else if (hitCheck.shapeType == EHitCheckShape.Capsule || hitCheck.shapeType == EHitCheckShape.Cylinder)
            {
                GizmosExtension.DrawCylinder(pos, normal, debugDummy.transform.forward, hitCheck.radius, hitCheck.height);
            }
            else if (hitCheck.shapeType == EHitCheckShape.LaserBeam)
            {
            }
        }
    }
    void OnSceneGUIdelay()
    {
        GameController gc     = (GameController)target;
        Vector3        relPos = Vector3.zero;

        /* Spawn 1 */
        relPos        = Vector3.zero - gc.SpawnPoint1;
        Handles.color = Color.blue;
        Handles.CubeCap(1, gc.SpawnPoint1, Quaternion.LookRotation(relPos), 1f);

        // Draw arrow
        Handles.ArrowCap(1, gc.SpawnPoint1, Quaternion.LookRotation(relPos), 5f);

        // Label it
        Handles.Label(new Vector3(gc.SpawnPoint1.x, 1, gc.SpawnPoint1.z), "Spawn 1");

        /* Spawn 2 */
        relPos        = Vector3.zero - gc.SpawnPoint2;
        Handles.color = Color.green;
        Handles.CubeCap(2, gc.SpawnPoint2, Quaternion.LookRotation(relPos), 1f);

        // Draw arrow
        Handles.ArrowCap(2, gc.SpawnPoint2, Quaternion.LookRotation(relPos), 5f);

        // Label it
        Handles.Label(new Vector3(gc.SpawnPoint2.x, 1, gc.SpawnPoint2.z), "Spawn 2");
    }
示例#9
0
        // ---------------------------------------------------------------------
        //
        // Gizmos
        //
        // ---------------------------------------------------------------------

        public static Vector3 GizmoRectangle(Vector3 center)
        {
            Handles.color = new Color(
                Handles.zAxisColor.r,
                Handles.zAxisColor.g,
                Handles.zAxisColor.b,
                0.3f);
            Handles.DotCap(
                0,
                center,
                Quaternion.identity,
                HandleUtility.GetHandleSize(center) * 0.15f);
            Handles.color = Handles.zAxisColor;
            Handles.ArrowCap(
                0,
                center,
                Quaternion.identity,
                HandleUtility.GetHandleSize(center));
            Handles.color = Handles.zAxisColor;
            return(Handles.FreeMoveHandle(
                       center,
                       Quaternion.identity,
                       HandleUtility.GetHandleSize(center) * 0.15f,
                       Vector3.zero,
                       Handles.RectangleCap));
        }
示例#10
0
        public override bool SceneEdit(ref SplinePoint[] points, ref List <int> selected)
        {
            bool change = false;

            if (transformer == null)
            {
                Reset(ref points, ref selected);
            }
            if (rotateNormals)
            {
                Handles.color = new Color(Color.yellow.r, Color.yellow.g, Color.yellow.b, 0.4f);
                for (int i = 0; i < selected.Count; i++)
                {
                    Vector3 normal = points[selected[i]].normal;
                    normal *= HandleUtility.GetHandleSize(points[selected[i]].position);
                    Handles.DrawLine(points[selected[i]].position, points[selected[i]].position + normal);
                    Handles.ArrowCap(0, points[selected[i]].position + normal, Quaternion.LookRotation(normal), HandleUtility.GetHandleSize(points[selected[i]].position));
                }
            }
            Handles.color = Color.white;
            Quaternion lastRotation = transformer.rotation;

            transformer.rotation = Handles.RotationHandle(lastRotation, transformer.center);
            if (lastRotation != transformer.rotation)
            {
                change = true;
                points = transformer.GetRotated(rotateNormals, rotateTangents);
            }
            return(change);
        }
示例#11
0
    /******************************************************
    * MonoBehaviour methods, OnDrawGizmos
    ******************************************************/

#if UNITY_EDITOR
    void OnDrawGizmos()
    {
        if (manager.ShowPaths)
        {
            if (Selection.gameObjects.Length > 0 && Selection.gameObjects[0] == this.gameObject)
            {
                Gizmos.color  = Color.red;
                Handles.color = Color.red;
            }
            else
            {
                Gizmos.color  = Color.green;
                Handles.color = Color.green;
            }
            for (int i = 0; i < ToLocations.Count; i++)
            {
                Gizmos.DrawLine(this.transform.position, ToLocations[i].transform.position);
                Handles.ArrowCap(0,
                                 this.transform.position,
                                 Quaternion.LookRotation(-(this.transform.position - ToLocations[i].transform.position).normalized),
                                 6);
            }
            IWeight weightInterface = (IWeight)GetComponent(typeof(IWeight));
            if (weightInterface != null)
            {
                Gizmos.color = Color.blue;
            }
            else
            {
                Gizmos.color = Color.yellow;
            }

            Gizmos.DrawSphere(transform.position, 1);
        }
    }
        protected virtual void OnSceneGUI()
        {
            Transform t = (serializedObject.targetObject as VLSDirectional).transform;

            Handles.color = (serializedObject.targetObject as VLSDirectional).Color;
            Handles.ArrowCap(0, (t.up * t.localScale.y * 0.5f) + t.position, Quaternion.FromToRotation(t.forward, -t.up), HandleUtility.GetHandleSize(t.position) * 0.5f);
        }
示例#13
0
        private static void DrawBox(Bounds?bound, Transform t, Color c)
        {
            var oColor = Handles.color;

            Handles.color = CYAN_A50;

            if (bound != null)
            {
                var b  = bound.Value;
                var v0 = b.min;
                var v7 = b.max;

                var v1 = new Vector3(v0.x, v0.y, v7.z);
                var v2 = new Vector3(v0.x, v7.y, v7.z);
                var v3 = new Vector3(v0.x, v7.y, v0.z);

                var v4 = new Vector3(v7.x, v0.y, v7.z);
                var v5 = new Vector3(v7.x, v0.y, v0.z);
                var v6 = new Vector3(v7.x, v7.y, v0.z);


                Handles.DrawPolyLine(
                    v0, v1, v2, v3, v0,
                    v5, v6, v7, v4, v5
                    );

                Handles.DrawLine(v1, v4);
                Handles.DrawLine(v2, v7);
                Handles.DrawLine(v3, v6);
            }

            if (t != null)
            {
                //Handles.ArrowCap(0, t.position, t.rotation, 1f);
                if (bound != null)
                {
                    Handles.DrawLine(t.position, bound.Value.center);
                }

                var sz = HandleUtility.GetHandleSize(t.position);

                Handles.color = GREEN_A50;
                Handles.ArrowCap(0,
                                 t.position,
                                 Quaternion.LookRotation(t.up),
                                 sz);
                Handles.color = BLUE_A50;
                Handles.ArrowCap(0,
                                 t.position,
                                 Quaternion.LookRotation(t.forward),
                                 sz);
                Handles.color = RED_A50;
                Handles.ArrowCap(0,
                                 t.position,
                                 Quaternion.LookRotation(t.right),
                                 sz);
            }

            Handles.color = oColor;
        }
示例#14
0
		void XYMoveRectangle() {
			Handles.color = new Color(
				Handles.zAxisColor.r,
				Handles.zAxisColor.g,
				Handles.zAxisColor.b,
				0.3f);
			Handles.DotCap(
				0,
				_viewCenter,
				Quaternion.identity,
				HandleUtility.GetHandleSize(_viewCenter) * 0.15f);
			Handles.color = Handles.zAxisColor;
			Handles.ArrowCap(
				0,
				_viewCenter,
				Quaternion.identity,
				HandleUtility.GetHandleSize(_viewCenter));
			Handles.color = Handles.zAxisColor;
			var delta = Handles.FreeMoveHandle(
				_viewCenter,
				Quaternion.identity,
				HandleUtility.GetHandleSize(_viewCenter) * 0.15f,
				Vector3.zero,
				Handles.RectangleCap) - _viewCenter;
			if ( delta.magnitude > Mathf.Epsilon ) {
				_viewCenter = _center + XYMoveIsoObjects(_viewCenter - _center + delta);
			}
		}
示例#15
0
    void OnSceneGUI( )
    {
        FirearmLinker t = target as FirearmLinker;

        Handles.color = Color.white;
        Handles.ArrowCap(0, t.transform.position, t.transform.rotation, arrowSize);            //the firing point forward indicator arrow
    }
示例#16
0
        private void DrawGizmos()
        {
                        #if UNITY_EDITOR
            if (DoDrawGizmos)
            {
                Matrix4x4 trs = Matrix4x4.TRS(transform.position, Quaternion.identity, Vector3.one);
                Handles.matrix *= trs;

                Handles.color = Color.cyan;
                Handles.DrawLines(new Vector3 [] { p0, p1, pc_a, pc_b, p0_a, p0_b, p1_a, p1_b });
                Handles.CircleCap(0, p0, Quaternion.identity, 1f * Radius);
                Handles.CircleCap(0, p1, Quaternion.identity, 1f * Radius);

                Handles.color = Color.yellow;
                if (position_list != null)
                {
                    for (int i = 0; i < position_list.Count; i++)
                    {
                        Vector3 p   = position_list [i];
                        Vector3 dir = direction_list [i];
                        Handles.CircleCap(0, p, Quaternion.identity, .01f);
                        Handles.ArrowCap(0, p, Quaternion.FromToRotation(-Vector3.back, dir), .1f);
                    }
                }

                Handles.matrix *= trs.inverse;
            }
                        #endif
        }
示例#17
0
    void OnSceneGUI()
    {
        Handles.ScaleSlider(10f, Vector3.one, Vector3.up, Quaternion.identity, 1, 1);
        Handles.ArrowCap(0, (target as ConnectedObjects).transform.position + new Vector3(5, 0, 0),
                         (target as ConnectedObjects).transform.rotation,
                         1f);
        Handles.DrawSolidArc(Vector3.one, Vector3.up, Vector3.forward, 90f, 10f);
        ConnectedObjects connectedObjects = target as ConnectedObjects;

        if (connectedObjects.objs == null)
        {
            return;
        }

        Vector3 center = connectedObjects.transform.position;

        for (int i = 0; i < connectedObjects.objs.Length; i++)
        {
            GameObject connectedObject = connectedObjects.objs[i];
            if (connectedObject)
            {
                Handles.DrawDottedLine(center, connectedObject.transform.position, dashSize);
            }
            else
            {
                Handles.DrawDottedLine(center, Vector3.zero, dashSize);
            }
        }
    }
示例#18
0
		protected override void Editor_OnSceneGUI()
		{
			var path = moveAlongPath.path;
            if (path)
			{
				_fromLocation = path.GetLocationByLength(_from, _fromLocation.index);
				var position = path.GetPoint(_fromLocation);
				var direction = path.GetTangent(_fromLocation);
				float handleSize = HandleUtility.GetHandleSize(position);

				Handles.color = _beginColor;
				Handles.DrawWireDisc(position, direction, handleSize * _discSize);
				float arrowLength = handleSize * _arrowSize;
				Handles.ArrowCap(0, position, Quaternion.LookRotation(_from > _to ? -direction : direction), arrowLength);

				_toLocation = path.GetLocationByLength(_to, _toLocation.index);
				position = path.GetPoint(_toLocation);
				direction = path.GetTangent(_toLocation);
				handleSize = HandleUtility.GetHandleSize(position);

				Handles.color = _endColor;
				Handles.DrawWireDisc(position, direction, handleSize * _discSize);
				arrowLength = handleSize * _arrowSize;
				if (_from > _to) direction  = - direction;
                Handles.ArrowCap(0, position - direction * arrowLength, Quaternion.LookRotation(direction), arrowLength);
			}
		}
示例#19
0
文件: IKTip.cs 项目: Gummiente/UISTa7
            private void VisualizeKinematicJoint(KinematicJoint joint)
            {
                Vector3 connection = joint.ComputeConnectionInWorldSpace();

                Handles.color = Color.magenta;
                Handles.SphereCap(0, connection, Quaternion.identity, 1 / 100f);

                GUIStyle style = new GUIStyle();

                style.normal.textColor = Color.black;
                Handles.Label(connection, joint.name, style);

                if (joint.XMotion.State == JointState.Free)
                {
                    Handles.color = Color.red;
                    Handles.ArrowCap(0, connection, joint.transform.rotation * Quaternion.LookRotation(joint.ComputeXAxis()), 0.1f);
                }
                if (joint.YMotion.State == JointState.Free)
                {
                    Handles.color = Color.green;
                    Handles.ArrowCap(0, connection, joint.transform.rotation * Quaternion.LookRotation(joint.ComputeYAxis()), 0.1f);
                }
                if (joint.ZMotion.State == JointState.Free)
                {
                    Handles.color = Color.blue;
                    Handles.ArrowCap(0, connection, joint.transform.rotation * Quaternion.LookRotation(joint.ComputeZAxis()), 0.1f);
                }
            }
示例#20
0
    public void DrawRotationPoint()
    {
        if (rotationPoints == null || rotationPoints.Count < 1)
        {
            return;
        }

        foreach (RotationPoint rotPoint in rotationPoints)
        {
            Gizmos.color = Color.yellow;
            Gizmos.DrawWireSphere(rotPoint.position, ROTATION_POINT_RADIUS);

            Vector3    prevPosition = model.position;
            Quaternion prevRotation = model.rotation;

            model.Translate(rotPoint.position);
            model.Rotate(rotPoint.rotation.eulerAngles);

            // Gizmos.color = Color.green;
            // Gizmos.DrawLine(rotPoint.position, (model.up * 1.1f + rotPoint.position));
            Handles.ArrowCap(0, rotPoint.position, rotPoint.rotation * Quaternion.Euler(-90, 0, 0), 2 * ROTATION_POINT_RADIUS);

            model.position = prevPosition;
            model.rotation = prevRotation;
        }
    }
示例#21
0
        internal static void OnSceneRotationHints(int id, Preset preset, float clock01)
        {
            if (Application.isPlaying || Tools.current != Tool.Rotate)
            {
                return;
            }

            Transform
                cam            = preset.Instance.m_CameraOrbitPivot.transform,
                lookAt         = preset.Instance.GetCameraLookAt();
            VirtualPosition vp = preset.m_VirtualPosition;

            Handles.color = clock01 > .5f? Color.red : Color.blue;
            if (clock01 > .5f)
            {
                Handles.ArrowCap(id, cam.position, (vp.m_Camera.m_OppositePolar ? Quaternion.LookRotation(cam.right, cam.up) : Quaternion.LookRotation(-cam.right, cam.up)), clock01 * .5f);
            }
            else
            {
                Handles.ArrowCap(id, cam.position, (vp.m_Camera.m_OppositeElevation ? Quaternion.LookRotation(cam.up, -cam.forward) : Quaternion.LookRotation(-cam.up, cam.forward)), clock01 * .5f);
            }

            if (vp.m_EnableLookTarget)
            {
                if (clock01 > .5f)
                {
                    Handles.ArrowCap(id, lookAt.position, (vp.m_LookTarget.m_OppositePolar ? Quaternion.LookRotation(lookAt.right, lookAt.up) : Quaternion.LookRotation(-lookAt.right, lookAt.up)), clock01 * .5f);
                }
                else
                {
                    Handles.ArrowCap(id, lookAt.position, (vp.m_LookTarget.m_OppositeElevation ? Quaternion.LookRotation(lookAt.up, -lookAt.forward) : Quaternion.LookRotation(-lookAt.up, lookAt.forward)), clock01 * .5f);
                }
            }
        }
示例#22
0
文件: IKTip.cs 项目: Gummiente/UISTa7
            public virtual void OnSceneGUI()
            {
                //Draw Kinematic Chain
                IKBody body = SearchIKBody();

                if (body != null)
                {
                    DrawKinematicChain(new Chain(body.transform, Target.transform));
                }

                //Draw Objective
                if (Target.Objective != null)
                {
                    if (Target.Objective.Type == ObjectiveType.Position)
                    {
                        Handles.SphereCap(0, Target.transform.position, Quaternion.identity, Target.Objective.MaximumPositionError);
                    }
                    if (Target.Objective.Type == ObjectiveType.Orientation)
                    {
                        //Visualized by Unity's Transform
                    }
                    if (Target.Objective.Type == ObjectiveType.Pose)
                    {
                        Handles.SphereCap(0, Target.transform.position, Quaternion.identity, Target.Objective.MaximumPositionError);
                    }
                    if (Target.Objective.Type == ObjectiveType.LookAt)
                    {
                        Handles.ArrowCap(0, Target.transform.position, Target.transform.rotation * Quaternion.LookRotation(Target.Objective.Direction), 0.05f);
                    }
                }
            }
示例#23
0
        private void DrawJoint(KinematicJoint joint)
        {
            Vector3 connection = joint.GetAnchorInWorldSpace();

            //DrawSphere(connection, JointSize, JointColor);
            DrawCube(connection, joint.transform.rotation * Quaternion.Euler(joint.GetOrientation()), JointSize, JointColor);
            DrawLine(joint.transform.position, joint.GetAnchorInWorldSpace(), JointColor);

            //GUIStyle style = new GUIStyle();
            //style.normal.textColor = Color.black;
            //Handles.Label(connection, joint.name, style);

            if (joint.GetXMotion().IsEnabled())
            {
                Handles.color = Color.red;
                Handles.ArrowCap(0, connection, joint.transform.rotation * Quaternion.LookRotation(joint.GetXMotion().Axis), ArrowSize);
            }
            if (joint.GetYMotion().IsEnabled())
            {
                Handles.color = Color.green;
                Handles.ArrowCap(0, connection, joint.transform.rotation * Quaternion.LookRotation(joint.GetYMotion().Axis), ArrowSize);
            }
            if (joint.GetZMotion().IsEnabled())
            {
                Handles.color = Color.blue;
                Handles.ArrowCap(0, connection, joint.transform.rotation * Quaternion.LookRotation(joint.GetZMotion().Axis), ArrowSize);
            }
        }
 private static void ShowTangent(Vector3 position, Vector3 tangent, float size)
 {
     if (tangent.sqrMagnitude > 0.0001f)
     {
         Handles.ArrowCap(0, position, Quaternion.LookRotation(tangent), BGEditorUtility.GetHandleSize(position, size));
     }
 }
示例#25
0
    public virtual void DrawSceneGUI()
    {
        MegaModifier mod = (MegaModifier)target;

        if (mod.ModEnabled && mod.DisplayGizmo && MegaModifiers.GlobalDisplay && showmodparams)
        {
            MegaModifiers context = mod.GetComponent <MegaModifiers>();

            if (context != null && context.Enabled && context.DrawGizmos)
            {
                //mod.Offset = -Handles.PositionHandle(-mod.Offset, Quaternion.identity);
                float a   = mod.gizCol1.a;
                Color col = Color.white;

                Quaternion rot = mod.transform.localRotation;

                Handles.matrix = Matrix4x4.identity;

                if (mod.Offset != Vector3.zero)
                {
                    Vector3 pos = mod.transform.localToWorldMatrix.MultiplyPoint(-mod.Offset);
                    Handles.Label(pos, mod.ModName() + " Offset\n" + mod.Offset.ToString("0.000"));
                    col           = Color.blue;
                    col.a         = a;
                    Handles.color = col;
                    Handles.ArrowCap(0, pos, rot * Quaternion.Euler(180.0f, 0.0f, 0.0f), mod.GizmoSize());
                    col           = Color.green;
                    col.a         = a;
                    Handles.color = col;
                    Handles.ArrowCap(0, pos, rot * Quaternion.Euler(90.0f, 0.0f, 0.0f), mod.GizmoSize());
                    col           = Color.red;
                    col.a         = a;
                    Handles.color = col;
                    Handles.ArrowCap(0, pos, rot * Quaternion.Euler(0.0f, -90.0f, 0.0f), mod.GizmoSize());
                }

                // gizmopos
                if (mod.gizmoPos != Vector3.zero)
                {
                    Vector3 pos = mod.transform.localToWorldMatrix.MultiplyPoint(-mod.gizmoPos);
                    Handles.Label(pos, mod.ModName() + " Pos\n" + mod.gizmoPos.ToString("0.000"));
                    col           = Color.blue;
                    col.a         = a;
                    Handles.color = col;
                    Handles.ArrowCap(0, pos, rot * Quaternion.Euler(180.0f, 0.0f, 0.0f), mod.GizmoSize());
                    col           = Color.green;
                    col.a         = a;
                    Handles.color = col;
                    Handles.ArrowCap(0, pos, rot * Quaternion.Euler(90.0f, 0.0f, 0.0f), mod.GizmoSize());
                    col           = Color.red;
                    col.a         = a;
                    Handles.color = col;
                    Handles.ArrowCap(0, pos, rot * Quaternion.Euler(0.0f, -90.0f, 0.0f), mod.GizmoSize());
                }

                Handles.matrix = Matrix4x4.identity;
            }
        }
    }
		public static void DrawArrowCap(int controlID, Vector3 position, Quaternion rotation, float size)
		{
#if UNITY_2017_1_OR_NEWER
			Handles.ArrowHandleCap(controlID, position, rotation, size, EventType.Repaint);
#else
			Handles.ArrowCap(controlID, position, rotation, size);
#endif
		}
示例#27
0
 void DrawArrowCap(int controlID, Vector3 position, Quaternion rotation, float size, EventType eventType)
 {
         #if UNITY_5_6_OR_NEWER
     Handles.ArrowHandleCap(controlID, position, rotation, size, eventType);
         #else
     Handles.ArrowCap(controlID, position, rotation, size);
         #endif
 }
示例#28
0
    void ArrowCap(int id, Vector3 pos, Quaternion rot, float size)
    {
#if UNITY_5_6 || UNITY_2017
        Handles.ArrowHandleCap(id, pos, rot, size, EventType.Repaint);
#else
        Handles.ArrowCap(id, pos, rot, size);
#endif
    }
示例#29
0
    void ArrowCapProxy(int controlId, Vector3 position, Quaternion rotation, float size)
    {
#if UNITY_5_6_OR_NEWER
        Handles.ArrowHandleCap(controlId, position, rotation, size, Event.current.type);
#else
        Handles.ArrowCap(controlId, position, rotation, size);
#endif
    }
示例#30
0
        public static void DrawArrowCap(Vector3 position, Quaternion rotation, float size)
        {
#if UNITY_5_5_OR_NEWER
            Handles.ArrowHandleCap(0, position, rotation, size, EventType.Repaint);
#else
            Handles.ArrowCap(0, position, rotation, size);
#endif
        }