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); }
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.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); }