示例#1
0
    public void Synchronize(Robot robot, GameObject rootObject, string assetRoot)
    {
        GameObject robotGameObject = rootObject;

        robotGameObject.AddComponentIfNotExists <UrdfRobot>();

        UrdfAssetPathHandler.SetPackageRoot(assetRoot);
        UrdfMaterial.InitializeRobotMaterials(robot);
        UrdfPlugins.Synchronize(robotGameObject.transform, robot.plugins);

        UrdfLinkExtensions.Synchronize(robotGameObject.transform, robot.root);
    }
示例#2
0
        /// <summary>
        /// Synchronizes the <paramref name="rootObject"/> with the <paramref name="robot"/>
        /// </summary>
        /// <param name="robot"></param>
        /// <param name="rootObject"></param>
        public void Synchronize(Robot robot, GameObject rootObject)
        {
            LocateAssetHandler.SetRobotName(robot.name);

            GameObject robotGameObject = rootObject;

            robotGameObject.AddComponentIfNotExists <UrdfRobot>();

            UrdfPlugins.Synchronize(robotGameObject.transform, robot.plugins);

            UrdfLinkExtensions.Synchronize(robotGameObject.transform, robot.root);

            //These tags are needed for the Camera/Sensors to interact with the gameobject
            foreach (var child in rootObject.GetComponentsInChildren <Transform>())
            {
                child.gameObject.tag = "Robot";
            }
        }
        public override void OnInspectorGUI()
        {
            urdfLink = (UrdfLink)target;

            GUILayout.Space(5);
            urdfLink.IsBaseLink = EditorGUILayout.Toggle("Is Base Link", urdfLink.IsBaseLink);
            GUILayout.Space(5);

            EditorGUILayout.BeginVertical("HelpBox");
            jointType = (UrdfJoint.JointTypes)EditorGUILayout.EnumPopup(
                "Child Joint Type", jointType);

            if (GUILayout.Button("Add child link (with joint)"))
            {
                UrdfLink childLink = UrdfLinkExtensions.Create(urdfLink.transform).GetComponent <UrdfLink>();
                UrdfJoint.Create(childLink.gameObject, jointType);
            }
            EditorGUILayout.EndVertical();
        }