private static void ImportLinkData(this UrdfLink urdfLink, Link link, Joint joint) { if (link.inertial == null && joint == null) { urdfLink.IsBaseLink = true; } urdfLink.gameObject.name = link.name; if (joint?.origin != null) { UrdfOrigin.ImportOriginData(urdfLink.transform, joint.origin); } if (link.inertial != null) { UrdfInertial.Create(urdfLink.gameObject, link.inertial); if (joint != null) { UrdfJoint.Create(urdfLink.gameObject, UrdfJoint.GetJointType(joint.type), joint); } } else if (joint != null) { UrdfJoint.Create(urdfLink.gameObject, UrdfJoint.GetJointType(joint.type), joint); } }
public static GameObject Create(Transform parent, Link link = null, Joint joint = null) { GameObject linkObject = new GameObject("link"); linkObject.transform.SetParentAndAlign(parent); UrdfLink urdfLink = linkObject.AddComponent <UrdfLink>(); UrdfVisualsExtensions.Create(linkObject.transform, link?.visuals); UrdfCollisionsExtensions.Create(linkObject.transform, link?.collisions); if (link != null) { urdfLink.ImportLinkData(link, joint); } else { UrdfInertial.Create(linkObject); #if UNITY_EDITOR UnityEditor.EditorGUIUtility.PingObject(linkObject); #endif } return(linkObject); }