Example #1
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);
        }
Example #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);
        }
        public static void Create(Transform parent, Link.Collision collision)
        {
            if (String.IsNullOrEmpty(collision.name))
            {
                collision.name = collision.GenerateNonReferenceID();
            }

            if (parent.FindChildOrCreateWithComponent(collision.name, out GameObject collisionObject, out UrdfCollision urdfCollision))
            {
                urdfCollision.geometryType = UrdfGeometry.GetGeometryType(collision.geometry);

                UrdfGeometryCollision.Create(collisionObject.transform, urdfCollision.geometryType, collision.geometry);
                UrdfOrigin.ImportOriginData(collisionObject.transform, collision.origin);
            }
        }
Example #4
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);
        }