Ejemplo n.º 1
0
 public static Vector3 DirectionHandleVec(Vector3 position, float sizeFactor, Vector3 initialDir, Vector3 axis)
 {
     if (axis.x == 1f && EditorGUIExtension.DirectionHandle(position, Vector3.right, sizeFactor, Color.red))
     {
         return(Vector3.right);
     }
     else if (axis.y == 1f && EditorGUIExtension.DirectionHandle(position, Vector3.up, sizeFactor, Color.green))
     {
         return(Vector3.up);
     }
     else if (axis.z == 1f && EditorGUIExtension.DirectionHandle(position, Vector3.forward, sizeFactor, Color.blue))
     {
         return(Vector3.forward);
     }
     else if (axis.x == 1f && EditorGUIExtension.DirectionHandle(position, Vector3.left, sizeFactor, Color.red))
     {
         return(Vector3.left);
     }
     else if (axis.y == 1f && EditorGUIExtension.DirectionHandle(position, Vector3.down, sizeFactor, Color.green))
     {
         return(Vector3.down);
     }
     else if (axis.z == 1f && EditorGUIExtension.DirectionHandle(position, Vector3.back, sizeFactor, Color.blue))
     {
         return(Vector3.back);
     }
     return(initialDir);
 }
Ejemplo n.º 2
0
    public void OnSceneGUI()
    {
        Vector3 pos        = aPosition.transform.position;
        float   sizeFactor = HandleUtility.GetHandleSize(pos) * 0.7f;

        if (EditorGUIExtension.DirectionHandle(pos, Vector3.right, sizeFactor, Color.red))
        {
            aPosition.direction = Vector3.right;
        }
        else if (EditorGUIExtension.DirectionHandle(pos, Vector3.up, sizeFactor, Color.green))
        {
            aPosition.direction = Vector3.up;
        }
        else if (EditorGUIExtension.DirectionHandle(pos, Vector3.forward, sizeFactor, Color.blue))
        {
            aPosition.direction = Vector3.forward;
        }
    }