Пример #1
0
 private void Update()
 {
     //For testing purposes-- > sends joint information then gets updated joint information, updates the information.
     if (Input.GetKeyDown(KeyCode.Space))
     {
         testList.PList[0].Rotation = 30;
         testList.PList[1].Rotation = 60;
         ObjectJoint.GetJoints(rootObject.GetComponent <ObjectJoint>().ChildObjectJoints, rootObject);
         ObjectJoint.SetJoints(testList, rootObject);
         Debug.Log("Complete!");
     }
 }
Пример #2
0
    private void Update()
    {
        // This is for first movement in the sequence
        if (Input.GetKeyDown(KeyCode.A))
        {
            testList.PList[4].Rotation = -45;
            testList.PList[5].Rotation = -45;
            testList.PList[8].Rotation = 90;
            testList.PList[9].Rotation = 90;
            ObjectJoint.SetJoints(testList, GameObject.Find("Sphere"));
        }

        // This is for the second movement in the sequence (repeate this and 3)
        if (Input.GetKeyDown(KeyCode.S))
        {
            testList.PList[4].Rotation = 45;
            testList.PList[5].Rotation = 45;
            testList.PList[8].Rotation = -90;
            testList.PList[9].Rotation = -90;

            testList.PList[2].Rotation = -45;
            testList.PList[3].Rotation = -45;
            testList.PList[6].Rotation = 90;
            testList.PList[7].Rotation = 90;

            ObjectJoint.SetJoints(testList, GameObject.Find("Sphere"));
        }

        // Third movement in the sequence
        if (Input.GetKeyDown(KeyCode.D))
        {
            testList.PList[4].Rotation = -45;
            testList.PList[5].Rotation = -45;
            testList.PList[8].Rotation = 90;
            testList.PList[9].Rotation = 90;

            testList.PList[2].Rotation = 45;
            testList.PList[3].Rotation = 45;
            testList.PList[6].Rotation = -90;
            testList.PList[7].Rotation = -90;

            GameObject root = GameObject.Find("Sphere");
            root.transform.Translate(Vector3.left * Time.deltaTime * 100);
            ObjectJoint.SetJoints(testList, GameObject.Find("Sphere"));
        }


#if ServerTesting
        // Configuring the robot with server test
        if (Input.GetKeyDown(KeyCode.A))
        {
            RobotStructure test = ClientUDP <RobotStructure> .UDPSend(8888, testStructure);

            ConstructionManager.GenerateRobot(test);
            ObjectJoint.GetJoints(GameObject.Find("Sphere").GetComponent <ObjectJoint>().ChildObjectJoints, GameObject.Find("Sphere"));
        }

        // Moving the thing
        if (Input.GetKeyDown(KeyCode.Space))
        {
            PositionListCreator.CreateList(GameObject.Find("Sphere"), testList.PList);
            PositionList newList = ClientUDP <PositionList> .UDPSend(7777, testList);

            ObjectJoint.SetJoints(newList, GameObject.Find("Sphere"));
        }
#endif
    }