Beispiel #1
0
    /// <summary>
    /// 绘制坐标系小正方体
    /// </summary>
    private void DrawCoordinateCube(Transform target)
    {
        Vector3 position = target.position;
        Vector3 euler    = target.eulerAngles;

        // 画坐标轴的小方块
        m_ShapesMaterial.SetPass(0);
        Mesh meshX = GLDraw.CreateCubeMesh(m_SelectedAxis == RuntimeHandleAxis.X ? m_SelectedColor : Color.red, Vector3.zero, m_CubeScale * m_ScreenScale);

        Graphics.DrawMeshNow(meshX, position + target.right * m_HandleScale * m_ScreenScale, target.rotation * Quaternion.Euler(0, 0, -90));
        Mesh meshY = GLDraw.CreateCubeMesh(m_SelectedAxis == RuntimeHandleAxis.Y ? m_SelectedColor : Color.green, Vector3.zero, m_CubeScale * m_ScreenScale);

        Graphics.DrawMeshNow(meshY, position + target.up * m_HandleScale * m_ScreenScale, target.rotation);
        Mesh meshZ = GLDraw.CreateCubeMesh(m_SelectedAxis == RuntimeHandleAxis.Z ? m_SelectedColor : Color.blue, Vector3.zero, m_CubeScale * m_ScreenScale);

        Graphics.DrawMeshNow(meshZ, position + target.forward * m_HandleScale * m_ScreenScale, target.rotation * Quaternion.Euler(90, 0, 0));

        Mesh meshO = GLDraw.CreateCubeMesh(m_SelectedAxis == RuntimeHandleAxis.XYZ ? m_SelectedColor : Color.white, Vector3.zero, m_CubeScale * m_ScreenScale);

        Graphics.DrawMeshNow(meshO, position, target.rotation);
    }