バーチャルアシスタント

Qt Quick このアプリケーションは、QMLとタイムラインを使って作成されたダイナミックなアニメーションで、バーチャル・アシスタントの3Dモデルを表示します。

バーチャル・アシスタントの例では、バーチャル・アシスタントの3Dモデルにタイムライン・アニメーションで命を吹き込み、ユーザーのエンゲージメントとインタラクションを高める方法を示しています。

3Dモデルのインポート

Qt Design Studio でモデルを読み込むには、.gltf ファイルをプロジェクトにインポートするだけです。Qt Design Studio では、オブジェクトを表す QML ファイルが自動的に作成されます。また、必要なアセットも生成されます。Qt Design Studio を使用しない場合は、手動でバルサムツールを実行する必要があります。この例では、生成された QML ファイルを変更して、ステート、アニメーション、およびバーチャル アシスタントの特定の部分をピックできるようにするインビジブル モデルを追加しています。

シーン環境の準備

このシーンでは、スカイボックスを作成し、自然な照明を提供するためにHDR画像を使用しています。

        environment: ExtendedSceneEnvironment {
            backgroundMode: SceneEnvironment.SkyBox
            lightProbe: Texture { source: Constants.sceneName }
            antialiasingMode: SceneEnvironment.MSAA
            antialiasingQuality: SceneEnvironment.VeryHigh
            fxaaEnabled: true
            probeExposure: 0.6
            probeOrientation: Qt.vector3d(0, settingsPanel.skyboxRotation, 0)
            specularAAEnabled: true
            tonemapMode: SceneEnvironment.TonemapModeLinear
            vignetteEnabled: true
            vignetteRadius: 0.15
        }

カメラオプション

カメラのプロパティは設定パネルから変更できます。スライダを使用して、視野(FOV)とスカイボックスの回転を操作できます。チェックボックスは、カメラの位置と回転をインタラクティブに変更できるOrbitCameraController を有効にします。

アニメーション

アニメーションは、複数のTimeline タイムラインとKeyframe キーフレームを使用して作成されます。各Timeline はバーチャルアシスタントの異なる状態と接続されています。状態が変わると、接続されたアニメーションがすぐに再生を開始します。各アニメーションが終了すると、オブジェクトはデフォルトの状態に戻り、モデルnodes の位置や回転などのデフォルト値が復元されます。アニメーションは、スケルトンのノードのプロパティ値を変更し、顔の要素(目、口)をアニメーションさせるために、異なるmorph targets のウェイトを変更します。

アニメーションを実行するには、アニメーションパネルのボタンを使います。また、手、下半身、顔などの特定のモデル要素をクリックして、モデルのその部分に関連するアニメーションを有効にします。

スケルトンアニメーション
  • 入口アニメーション
  • 退場アニメーション
  • シーン探索アニメーション
  • バク転アニメーション
  • 下半身バウンドアニメーション
  • 左右の手を振るアニメーション
モーフターゲットアニメーション
  • 顔のアニメーション(幸せと悲しみ)

モデルの左手を振るアニメーションの実装例:

Timeline {
    id: leftHandWavingTimeline
    animations: [
        TimelineAnimation {
            id: leftHandWavingAnimation
            onFinished: node.restoreDefaults()
            running: false
            loops: 1
            duration: 2000
            to: 2000
            from: 0
        }
    ]
    startFrame: 0
    endFrame: 2000
    enabled: false

    KeyframeGroup {
        target: hand_l
        property: "x"
        Keyframe {
            value: 2.89
            frame: 400
        }

        Keyframe {
            value: 2.89
            frame: 1600
        }

        Keyframe {
            value: 1.89
            frame: 2000
        }
    }

    KeyframeGroup {
        target: hand_l
        property: "y"
        Keyframe {
            value: 1
            frame: 400
        }

        Keyframe {
            value: 1
            frame: 1600
        }

        Keyframe {
            value: 0.5
            frame: 2000
        }
    }

    KeyframeGroup {
        target: hand_l
        property: "z"
        Keyframe {
            value: 1
            frame: 400
        }

        Keyframe {
            value: 1
            frame: 1600
        }

        Keyframe {
            value: -0.1
            frame: 2000
        }
    }

    KeyframeGroup {
        target: hand_l
        property: "eulerRotation.x"
        Keyframe {
            value: -15
            frame: 400
        }

        Keyframe {
            value: -5
            frame: 700
        }

        Keyframe {
            value: -15
            frame: 1000
        }

        Keyframe {
            value: -5
            frame: 1300
        }

        Keyframe {
            value: -15
            frame: 1600
        }

        Keyframe {
            value: -0.18
            frame: 2000
        }
    }

    KeyframeGroup {
        target: hand_l
        property: "eulerRotation.y"
        Keyframe {
            value: -15
            frame: 400
        }

        Keyframe {
            value: -30
            frame: 1600
        }

        Keyframe {
            value: -145
            frame: 2000
        }

        Keyframe {
            value: -40
            frame: 700
        }
    }

    KeyframeGroup {
        target: hand_l
        property: "eulerRotation.z"
        Keyframe {
            value: -88
            frame: 400
        }

        Keyframe {
            value: -30
            frame: 700
        }

        Keyframe {
            value: -86.05
            frame: 1000
        }

        Keyframe {
            value: -30
            frame: 1300
        }

        Keyframe {
            value: -86.05
            frame: 1600
        }

        Keyframe {
            value: -178.92
            frame: 2000
        }
    }

    KeyframeGroup {
        target: morphTarget38
        property: "weight"
        Keyframe {
            value: 1
            frame: 0
        }

        Keyframe {
            value: 0.25
            frame: 400
        }

        Keyframe {
            value: 0.25
            frame: 1600
        }

        Keyframe {
            value: 1
            frame: 2000
        }
    }

    KeyframeGroup {
        target: morphTarget42
        property: "weight"
        Keyframe {
            value: 0
            frame: 2000
        }

        Keyframe {
            value: 0.75
            frame: 1600
        }

        Keyframe {
            value: 0.75
            frame: 400
        }

        Keyframe {
            value: 0
            frame: 0
        }
    }

    KeyframeGroup {
        target: morphTarget27
        property: "weight"
        Keyframe {
            value: 0
            frame: 0
        }

        Keyframe {
            value: 1
            frame: 400
        }

        Keyframe {
            value: 1
            frame: 1600
        }

        Keyframe {
            value: 0
            frame: 2000
        }
    }

    KeyframeGroup {
        target: morphTarget28
        property: "weight"
        Keyframe {
            value: 1
            frame: 2000
        }

        Keyframe {
            value: 0
            frame: 1600
        }

        Keyframe {
            value: 0
            frame: 400
        }

        Keyframe {
            value: 1
            frame: 0
        }
    }
}

サンプルプロジェクト @ code.qt.io

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.