Exemplo n.º 1
0
        public Link.Collision ExportCollisionData()
        {
            CheckForUrdfCompatibility();

            Link.Geometry geometry      = UrdfGeometry.ExportGeometryData(geometryType, transform, true);
            string        collisionName = gameObject.name == "unnamed" ? null : gameObject.name;

            return(new Link.Collision(geometry, collisionName, UrdfOrigin.ExportOriginData(transform)));
        }
Exemplo n.º 2
0
        public static void Create(Transform parent, Link.Collision collision)
        {
            GameObject collisionObject = new GameObject("unnamed");

            collisionObject.transform.SetParentAndAlign(parent);
            UrdfCollision urdfCollision = collisionObject.AddComponent <UrdfCollision>();

            urdfCollision.geometryType = UrdfGeometry.GetGeometryType(collision.geometry);

            UrdfGeometryCollision.Create(collisionObject.transform, urdfCollision.geometryType, collision.geometry);
            UrdfOrigin.ImportOriginData(collisionObject.transform, collision.origin);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public Link.Visual ExportVisualData()
        {
            CheckForUrdfCompatibility();

            Link.Geometry geometry = UrdfGeometry.ExportGeometryData(geometryType, transform);

            Link.Visual.Material material = null;
            if (!(geometry.mesh != null && geometry.mesh.filename.ToLower().EndsWith(".dae"))) //Collada files contain their own materials
            {
                material = UrdfMaterial.ExportMaterialData(gameObject.GetComponentInChildren <MeshRenderer>().sharedMaterial);
            }

            string visualName = gameObject.name == "unnamed" ? null : gameObject.name;

            return(new Link.Visual(geometry, visualName, UrdfOrigin.ExportOriginData(transform), material));
        }