Esempio n. 1
0
    /// <summary>
    /// 末端点直线运动的实现代码
    /// </summary>
    /// <param name="Target">运动的终点</param>
    /// <returns></returns>
    IEnumerator SimpleMoveP(Vector3 Target)
    {
        MechanicalCCDIK.enabled = true;
        int     i          = 0;
        Vector3 StartPoint = GetGoInScene.GetInstance().PointTag.position;

        while (true)
        {
            i++;
            Vector3 nextPoint = GetIkpositionOffset(StartPoint, Target, i);
            MechanicalCCDIK.solver.SetIKPosition(nextPoint);
            //if (zhen.localPosition.y <= 0.146f && zhen.localPosition.y >= 0.093f)
            //{
            //    zhen.localPosition += new Vector3(0, 0.0001f, 0) * (Target.y - StartPoint.y);
            //}
            if (nextPoint == Target)
            {
                Debug.Log(nextPoint + "==========>" + Target);
                MechanicalCCDIK.enabled = false;

                StepManager.Instance.NextStep();

                break;
            }
            yield return(null);
        }
    }
Esempio n. 2
0
 public static GetGoInScene GetInstance()
 {
     if (instance == null)
     {
         instance = new GetGoInScene();
     }
     return(instance);
 }
Esempio n. 3
0
    /// <summary>
    /// 在末端点现在所在位置生成已保存位置点的标记
    /// </summary>
    /// <param name="name">标记显示的名字</param>
    public void ShowTag(string name)
    {
        //在3D场景中生成一个位置展示点
        GameObject go = Instantiate(Resources.Load <GameObject>(ResourcesPath), GetGoInScene.GetInstance().PointTag);

        go.transform.parent     = GameObject.Find("PointTags").transform;
        go.transform.localScale = new Vector3(0.03f, 0.03f, 0.03f);
        go.transform.Find("Text (TMP)").GetComponent <TextMeshPro>().text = name;
    }
Esempio n. 4
0
 void Update()
 {
     if (lastPosition != GetGoInScene.GetInstance().PointTag.position)
     {
         lastPosition = GetGoInScene.GetInstance().PointTag.position;
         x.text       = "X:   " + String.Format("{0:F}", GetGoInScene.GetInstance().PointTag.position.x);
         y.text       = "Y:   " + String.Format("{0:F}", GetGoInScene.GetInstance().PointTag.position.y);
         z.text       = "Z:   " + String.Format("{0:F}", GetGoInScene.GetInstance().PointTag.position.z);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 保存等待步骤相关的设置
 /// </summary>
 public override void OnButtonClicked()
 {
     base.OnButtonClicked();
     if (waitSettingPanel == null)
     {
         waitSettingPanel = GetGoInScene.GetInstance().GetGO("WaitSettingPanel");
     }
     waitSettingPanel.GetComponent <WaitingSettingPanelControl>().TargetTask = gameObject;
     waitSettingPanel.GetComponent <WaitingSettingPanelControl>().InitInputField();
     waitSettingPanel.SetActive(true);
 }
Esempio n. 6
0
    /// <summary>
    /// 当应用按钮被按下是调用,记录移动指令相关设置
    /// </summary>

    public override void OnButtonClicked()
    {
        base.OnButtonClicked();
        if (moveSettingPanel == null)
        {
            moveSettingPanel = GetGoInScene.GetInstance().GetGO("MoveSettingPanel");
        }
        moveSettingPanel.GetComponent <MoveSettingPanelControl>().TargetTask = gameObject;
        moveSettingPanel.GetComponent <MoveSettingPanelControl>().InitDropdown();
        moveSettingPanel.SetActive(true);
    }
Esempio n. 7
0
 /// <summary>
 /// 当应用按钮被点击时,记录相关设置
 /// </summary>
 public override void OnButtonClicked()
 {
     base.OnButtonClicked();
     if (shenjiangSettingPanel == null)
     {
         shenjiangSettingPanel = GetGoInScene.GetInstance().GetGO("GaodiSettingPanel");
     }
     shenjiangSettingPanel.GetComponent <GaodiSettingPanelControl>().TargetTask = gameObject;
     shenjiangSettingPanel.GetComponent <GaodiSettingPanelControl>().InitThis();
     shenjiangSettingPanel.SetActive(true);
 }
Esempio n. 8
0
    //public Action OnRotateComplete;
    //protected bool allowIn = true;
    /// <summary>
    /// 保存末端点和各关节信息
    /// </summary>
    /// <returns>存储末端点和各关节信息的类</returns>
    public JointsMessage SavePoint()
    {
        JointsMessage jointsMessage = new JointsMessage();

        for (int i = 0; i < jointsDic.Count; i++)
        {
            jointsMessage.jointRotation.Add(jointsDic["Joint" + i].localEulerAngles);
            jointsMessage.IKPoint = GetGoInScene.GetInstance().PointTag.position;
        }

        return(jointsMessage);
    }