public override void OnInspectorGUI() { urdfCollisions = (UrdfCollisions)target; GUILayout.Space(10); geometryType = (GeometryTypes)EditorGUILayout.EnumPopup("Type of collision", geometryType); if (GUILayout.Button("Add collision")) { UrdfCollisionExtensions.Create(urdfCollisions.transform, geometryType); } }
public static void Create(Transform parent, List <Link.Collision> collisions = null) { GameObject collisionsObject = new GameObject("Collisions"); collisionsObject.transform.SetParentAndAlign(parent); UrdfCollisions urdfCollisions = collisionsObject.AddComponent <UrdfCollisions>(); collisionsObject.hideFlags = HideFlags.NotEditable; urdfCollisions.hideFlags = HideFlags.None; if (collisions != null) { foreach (Link.Collision collision in collisions) { UrdfCollisionExtensions.Create(urdfCollisions.transform, collision); } } }
public static void AddCorrespondingCollision(this UrdfVisual urdfVisual) { UrdfCollisions collisions = urdfVisual.GetComponentInParent <UrdfLink>().GetComponentInChildren <UrdfCollisions>(); UrdfCollisionExtensions.Create(collisions.transform, urdfVisual.GeometryType, urdfVisual.transform); }