Example #1
0
        public static GameObject Create(this Link.Visual visual, GameObject parent)
        {
            GameObject gameObject = new GameObject((visual.name == null) ? "unnamed" : visual.name);

            gameObject.transform.SetParentAndAlign(parent.transform);

            if (visual.origin != null)
            {
                visual.origin.SetTransform(gameObject);
            }

            visual.geometry.CreateVisual(gameObject);


            if (visual.material != null)
            {
                UrdfAssetDatabase.SetMaterial(gameObject, visual.material.name);
            }

            if (gameObject.GetComponentInChildren <Renderer>().sharedMaterial == null)
            {
                UrdfAssetDatabase.SetDefaultMaterial(gameObject);
            }

            return(gameObject);
        }
        public static GameObject Create(this Link.Visual visual, GameObject parent)
        {
            GameObject gameObject = new GameObject((visual.name == null) ? "unnamed" : visual.name);

            gameObject.transform.SetParentAndAlign(parent.transform);

            if (visual.origin != null)
            {
                visual.origin.SetTransform(gameObject);
            }

            visual.geometry.CreateVisual(gameObject);

            UrdfMaterialHandler.SetUrdfMaterial(gameObject, visual.material);

            return(gameObject);
        }