Beispiel #1
0
        public static void Create(Transform parent, UrdfGeometry.GeometryTypes type, Transform visualToCopy = null)
        {
            GameObject collisionObject = new GameObject("unnamed");

            collisionObject.transform.SetParentAndAlign(parent);

            UrdfCollision urdfCollision = collisionObject.AddComponent <UrdfCollision>();

            urdfCollision.geometryType = type;

            if (visualToCopy != null)
            {
                if (urdfCollision.geometryType == UrdfGeometry.GeometryTypes.Mesh)
                {
                    UrdfGeometryCollision.CreateMatchingMeshCollision(collisionObject.transform, visualToCopy);
                }
                else
                {
                    UrdfGeometryCollision.Create(collisionObject.transform, type);
                }

                //copy transform values from corresponding UrdfVisual
                collisionObject.transform.position   = visualToCopy.position;
                collisionObject.transform.localScale = visualToCopy.localScale;
                collisionObject.transform.rotation   = visualToCopy.rotation;
            }
            else
            {
                UrdfGeometryCollision.Create(collisionObject.transform, type);
            }

            EditorGUIUtility.PingObject(collisionObject);
        }
        public override void OnInspectorGUI()
        {
            urdfCollisions = (UrdfCollisions)target;

            GUILayout.Space(10);
            geometryType = (UrdfGeometry.GeometryTypes)EditorGUILayout.EnumPopup("Type of collision", geometryType);

            if (GUILayout.Button("Add collision"))
            {
                UrdfCollision.Create(urdfCollisions.transform, geometryType);
            }
        }
        public static void Create(Transform parent, UrdfGeometry.GeometryTypes type)
        {
            GameObject visualObject = new GameObject("unnamed");

            visualObject.transform.SetParentAndAlign(parent);
            UrdfVisual urdfVisual = visualObject.AddComponent <UrdfVisual>();

            urdfVisual.geometryType = type;
            UrdfGeometryVisual.Create(visualObject.transform, type);

            EditorGUIUtility.PingObject(visualObject);
        }
Beispiel #4
0
        public override void OnInspectorGUI()
        {
            urdfVisuals = (UrdfVisuals)target;

            GUILayout.Space(10);
            geometryType = (UrdfGeometry.GeometryTypes)EditorGUILayout.EnumPopup("Type of visual", geometryType);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Add visual"))
            {
                UrdfVisual.Create(urdfVisuals.transform, geometryType);
            }
            EditorGUILayout.EndHorizontal();
        }