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); }
public static GameObject Create(this Robot robot) { if (UrdfAssetPathHandler.IsValidAssetPath(robot.filename)) { Debug.LogError("URDF file and ressources must be placed in Assets Folder:\n" + Application.dataPath); return(null); } UrdfAssetPathHandler.SetAssetRootFolder(robot); UrdfMaterialHandler.InitializeRobotMaterials(robot); GameObject gameObject = new GameObject(robot.name); robot.root.Create(gameObject); GameObjectUtility.SetParentAndAlign(gameObject, Selection.activeObject as GameObject); Undo.RegisterCreatedObjectUndo(gameObject, "Create " + gameObject.name); Selection.activeObject = gameObject; SetKinematic(gameObject, true); return(gameObject); }