예제 #1
0
        void OnSceneGUI()
        {
            var     posPort  = serializedObject.FindProperty("AnchorPosition");
            Vector3 position = posPort.vector3Value;

            if (Tools.current == Tool.Move)
            {
                EditorGUI.BeginChangeCheck();

                Quaternion rotation = Quaternion.identity;
                float      size     = HandleUtility.GetHandleSize(position) * 0.1f;

                Handles.SphereHandleCap(0, position, rotation, size, EventType.Repaint);

                Vector3 pos = Handles.PositionHandle(position, rotation);

                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(target, "Move Waypoint");

                    Vector3 offset = pos - posPort.vector3Value;
                    //				posPort.vector3Value = pos;
                    //				cTrans.UpdateRotate (pos);

                    var endPos = cTrans.Transport(offset);
                    posPort.vector3Value = endPos;

                    serializedObject.ApplyModifiedProperties();
                    //				wp.position = pos;
                    //				Target.m_Waypoints[i] = wp;
                    //				Target.InvalidateDistanceCache();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Dos the drag.
        /// </summary>
        /// <param name="data">Data.</param>
        void DoDrag(PointerEventData data)
        {
            //Debug.Log ("Do drag press postion " + oldPos);
            var offset = GetProjectOffset(data);

            //transform.position += offset;

            if (data.button == PointerEventData.InputButton.Left && bPicthOn)
            {
                if (!bShift)
                {
                    ciTrans.Transport(-offset);
                }
                else
                {
                    ciTrans.Pitch(offset.y * PitchSpeed);
                    UpdateOldPos(data);
                }
            }
            else if (data.button == PointerEventData.InputButton.Right ||
                     (PointerEventData.InputButton.Left == data.button && !bPicthOn))
            {
                ciTrans.Rotate(GetRotateOffset(offset) * RotateSpeed);
                UpdateOldPos(data);
            }
        }
예제 #3
0
        // Update is called once per frame
        void Update()
        {
            //for test
            if (Input.GetKey(KeyCode.A))
            {
                ciTrans.Rotate(1.1f);
            }
            if (Input.GetKey(KeyCode.D))
            {
                ciTrans.Rotate(-1.1f);
            }

            if (Input.GetKey(KeyCode.S))
            {
                ciTrans.Zoom(0.1f);
            }
            if (Input.GetKey(KeyCode.W))
            {
                ciTrans.Zoom(-0.1f);
            }

            if (Input.GetKey(KeyCode.G))
            {
                ciTrans.Pitch(0.1f);
            }
            if (Input.GetKey(KeyCode.T))
            {
                ciTrans.Pitch(-0.1f);
            }

            if (Input.GetKey(KeyCode.F))
            {
                ciTrans.Transport(0.1f * Vector3.forward);
            }

            if (Input.GetKey(KeyCode.R))
            {
                ciTrans.Transport(-0.1f * Vector3.forward);
            }
        }