예제 #1
0
        public static void Create(Transform parent, GeometryTypes type)
        {
            GameObject visualObject = new GameObject("unnamed");

            visualObject.transform.SetParentAndAlign(parent);
            UrdfVisual urdfVisual = visualObject.AddComponent <UrdfVisual>();

            urdfVisual.GeometryType = type;
            UrdfGeometryVisual.Create(visualObject.transform, type);
        }
예제 #2
0
        public static void Create(Transform parent, Link.Visual visual)
        {
            GameObject visualObject = new GameObject(visual.name ?? "unnamed");

            visualObject.transform.SetParentAndAlign(parent);
            UrdfVisual urdfVisual = visualObject.AddComponent <UrdfVisual>();

            urdfVisual.GeometryType = UrdfGeometry.GetGeometryType(visual.geometry);
            UrdfGeometryVisual.Create(visualObject.transform, urdfVisual.GeometryType, visual.geometry);

            UrdfMaterial.SetUrdfMaterial(visualObject, visual.material);
            UrdfOrigin.ImportOriginData(visualObject.transform, visual.origin);
        }
예제 #3
0
        public static void Create(Transform parent, Link.Visual visual)
        {
            if (String.IsNullOrEmpty(visual.name))
            {
                visual.name = visual.GenerateNonReferenceID();
            }

            if (parent.FindChildOrCreateWithComponent <UrdfVisual>(visual.name, out GameObject visualObject, out UrdfVisual urdfVisual))
            {
                //only create these visuals if the gameobject had to be created itself
                urdfVisual.GeometryType = UrdfGeometry.GetGeometryType(visual.geometry);
                UrdfGeometryVisual.Create(visualObject.transform, urdfVisual.GeometryType, visual.geometry);
            }

            //update these values every time
            UrdfMaterial.SetUrdfMaterial(visualObject, visual.material);
            UrdfOrigin.ImportOriginData(visualObject.transform, visual.origin);
        }