diff --git a/api/UniGLTF.RuntimeGltfInstance.html b/api/UniGLTF.RuntimeGltfInstance.html index 330360115..3c1b235c4 100644 --- a/api/UniGLTF.RuntimeGltfInstance.html +++ b/api/UniGLTF.RuntimeGltfInstance.html @@ -404,6 +404,38 @@ ex. Material, Texture, AnimationClip, Mesh.

Methods

+ + | + Improve this Doc + + + View Source + + +

AddRenderers(IEnumerable<Renderer>)

+
+
+
Declaration
+
+
public void AddRenderers(IEnumerable<Renderer> renderers)
+
+
Parameters
+ + + + + + + + + + + + + + + +
TypeNameDescription
System.Collections.Generic.IEnumerable<Renderer>renderers
| Improve this Doc @@ -461,7 +493,7 @@ ex. Material, Texture, AnimationClip, Mesh.

Improve this Doc
- View Source + View Source

Dispose()

@@ -476,7 +508,7 @@ ex. Material, Texture, AnimationClip, Mesh.

Improve this Doc - View Source + View Source

EnableUpdateWhenOffscreen()

@@ -491,7 +523,7 @@ ex. Material, Texture, AnimationClip, Mesh.

Improve this Doc - View Source + View Source

ShowMeshes()

@@ -506,7 +538,7 @@ ex. Material, Texture, AnimationClip, Mesh.

Improve this Doc - View Source + View Source

TransferOwnership(TakeResponsibilityForDestroyObjectFunc)

diff --git a/articles/en/toc.html b/articles/en/toc.html index 491976ec0..67ae99f2d 100644 --- a/articles/en/toc.html +++ b/articles/en/toc.html @@ -102,7 +102,7 @@ 🚧LookAt
  • - 🚧FirstPerson + FirstPerson
  • diff --git a/articles/en/vrm1/vrm1_firstperson.html b/articles/en/vrm1/vrm1_firstperson.html index cf6d31822..83a088b8f 100644 --- a/articles/en/vrm1/vrm1_firstperson.html +++ b/articles/en/vrm1/vrm1_firstperson.html @@ -5,9 +5,9 @@ - 🚧FirstPerson + Recommended camera layer settings - + @@ -68,6 +68,57 @@
    +

    The VR First Person settings.

    +
      +
    1. Load
    2. +
    3. Get VRM10Controller
    4. +
    5. Call controller.Vrm.FirstPerson.SetupAsync
    6. +
    7. Add the result of controller.Vrm.FirstPerson.SetupAsync to RuntimeGltfInstance
    8. +
    9. ShowMeshes
    10. +
    +
    async Task<RuntimeGltfInstance> LoadAsync(string path)
    +{
    +    var data = new GlbFileParser(path).Parse();
    +    if (!Vrm10Data.TryParseOrMigrate(data, true, out Vrm10Data vrm))
    +    {
    +        throw new System.Exception("vrm parse error !");
    +    }
    +    using (var loader = new Vrm10Importer(vrm))
    +    {
    +        // 1.
    +        var instance = await loader.LoadAsync();
    +
    +        // 2.
    +        var controller = instance.GetComponent<VRM10Controller>();
    +
    +        // 3.
    +        var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
    +
    +        // 4.
    +        instance.AddRenderers(created);
    +
    +        // 5.
    +        instance.ShowMeshes();
    +
    +        return instance;
    +    }
    +}
    +
    +

    Recommended camera layer settings

    +

    Suppose your scene has a camera that represents a head-mounted display and other cameras.

    + +

    Stops drawing the avatar from the head-mounted display perspective and makes it visible to other cameras.

    +

    Example: Stop drawing the avatar's head so you can see the front

    +

    VRM reserves layers named VRMFirstPersonOnly and VRMThirdPersonOnly.

    +

    Please set VRMFirstPersonOnly and VRMThirdPersonOnly to Project Settings-Tags and Layers.

    +

    In the sample, we assign 9 and 10 to each.

    +

    Specify layer at initialization

    +

    It can be specified with an additional argument.

    +
    var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject, firstPersonOnlyLayer: 9, thirdPersonOnlyLayer: 10);
    +
    diff --git a/articles/ja/toc.html b/articles/ja/toc.html index dda5ff43f..9f74de991 100644 --- a/articles/ja/toc.html +++ b/articles/ja/toc.html @@ -102,7 +102,7 @@ 🚧LookAt
  • - 🚧FirstPerson + FirstPerson
  • diff --git a/articles/ja/vrm1/vrm1_firstperson.html b/articles/ja/vrm1/vrm1_firstperson.html index 229f21140..64eed9879 100644 --- a/articles/ja/vrm1/vrm1_firstperson.html +++ b/articles/ja/vrm1/vrm1_firstperson.html @@ -5,9 +5,9 @@ - 🚧FirstPerson + Runtime に FirstPerson 機能を有効にする - + @@ -67,7 +67,62 @@
    +

    Runtime に FirstPerson 機能を有効にする

    +

    VR向け FirstPerson 設定の初期化手順です。

    +
      +
    1. Load する
    2. +
    3. VRM10Controller を取得する
    4. +
    5. controller.Vrm.FirstPerson.SetupAsync を呼び出す
    6. +
    7. controller.Vrm.FirstPerson.SetupAsync した結果新規に作成されたモデルを RuntimeGltfInstance に渡す
    8. +
    9. ShowMeshes
    10. +
    +
    async Task<RuntimeGltfInstance> LoadAsync(string path)
    +{
    +    var data = new GlbFileParser(path).Parse();
    +    if (!Vrm10Data.TryParseOrMigrate(data, true, out Vrm10Data vrm))
    +    {
    +        throw new System.Exception("vrm parse error !");
    +    }
    +    using (var loader = new Vrm10Importer(vrm))
    +    {
    +        // 1.
    +        var instance = await loader.LoadAsync();
    +
    +        // 2.
    +        var controller = instance.GetComponent<VRM10Controller>();
    +
    +        // 3.
    +        var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject);
    +
    +        // 4.
    +        instance.AddRenderers(created);
    +
    +        // 5.
    +        instance.ShowMeshes();
    +
    +        return instance;
    +    }
    +}
    +
    +

    VRMの推奨する VR 向けのカメラ構成

    +

    ヘッドマウントディスプレイを表すカメラ と その他のカメラという2種類のカメラを想定ます。 +それぞれに対して、

    +
      +
    • FIRSTPERSON_ONLY_LAYER(このレイヤーを指定した gameObject はその他のカメラから消えます)
    • +
    • THIRDPERSON_ONLY_LAYER(このレイヤーを指定した gameObject はヘッドマウントディスプレイから消えます)
    • +
    +

    を定義します。 +これにより、ヘッドマウント視点のアバターの描画を抑止しつつ、他者からは見えるようにします。

    +

    例: アバターの頭の描画を抑止して前が見えるようにする

    +

    VRMは、VRMFirstPersonOnlyVRMThirdPersonOnly という名前のレイヤーを予約しています。

    +

    Project Settings - Tags and LayersVRMFirstPersonOnlyVRMThirdPersonOnly を +設定してください。 +サンプルでは、それぞれに 910 を割り当ています。

    +

    初期化時に layer を明示する

    +

    追加の引数で指定できます。

    +
    var created = await controller.Vrm.FirstPerson.SetupAsync(controller.gameObject, firstPersonOnlyLayer: 9, thirdPersonOnlyLayer: 10);
    +
    diff --git a/manifest.json b/manifest.json index 8bf8a682d..a3da424ea 100644 --- a/manifest.json +++ b/manifest.json @@ -1704,7 +1704,7 @@ "output": { ".html": { "relative_path": "api/UniGLTF.RuntimeGltfInstance.html", - "hash": "eHkbZD5qmhSKC6q0kZPr8QVmRWj8uA+a5P7cfiiphog=" + "hash": "gWyc7mMox2UaSNxFo/HEu/XqOB9fwW1rtxOwKdE8U9A=" } }, "is_incremental": false, @@ -4536,7 +4536,7 @@ "output": { ".html": { "relative_path": "articles/en/toc.html", - "hash": "0xAo3eJaAstFH1Iz+d8jAM0gyJczjnYoEjCtsT7Q4Os=" + "hash": "5SFySDDewMpsCJjylz+AKeVrnC9aGai+Y1uGm6jexBE=" } }, "is_incremental": false, @@ -4644,7 +4644,7 @@ "output": { ".html": { "relative_path": "articles/en/vrm1/vrm1_firstperson.html", - "hash": "4NfjpLOrTfDhpNmmSkSO/omiBDMQWeqXpUTD729ViOY=" + "hash": "cOtWAwizRgVjhSi6kHzQGtB8IUFw8JRkuYc1C5pfLHU=" } }, "is_incremental": false, @@ -4779,7 +4779,7 @@ "output": { ".html": { "relative_path": "articles/ja/toc.html", - "hash": "lpMPaG+LLg4loS9KCp9yllBcKY/sM/ySq4Iq4Z9VNRw=" + "hash": "YdQkjc9A5Mqz1tzE8e15klA5+qQQIV/VLtdZ0fOO9TQ=" } }, "is_incremental": false, @@ -4887,7 +4887,7 @@ "output": { ".html": { "relative_path": "articles/ja/vrm1/vrm1_firstperson.html", - "hash": "BKH5xsdfhWLdmzBCikXDa2v3+hQhYuv91dUNCWHxEh0=" + "hash": "nYQW8tRWciP5m+I5CS8ZpOjikypFjHDSwwjsCqFG1Wk=" } }, "is_incremental": false, diff --git a/xrefmap.yml b/xrefmap.yml index 7a616fe63..a20c4c73a 100644 --- a/xrefmap.yml +++ b/xrefmap.yml @@ -11619,6 +11619,22 @@ references: commentId: T:UniGLTF.RuntimeGltfInstance fullName: UniGLTF.RuntimeGltfInstance nameWithType: RuntimeGltfInstance +- uid: UniGLTF.RuntimeGltfInstance.AddRenderers(System.Collections.Generic.IEnumerable{Renderer}) + name: AddRenderers(IEnumerable) + href: api/UniGLTF.RuntimeGltfInstance.html#UniGLTF_RuntimeGltfInstance_AddRenderers_System_Collections_Generic_IEnumerable_Renderer__ + commentId: M:UniGLTF.RuntimeGltfInstance.AddRenderers(System.Collections.Generic.IEnumerable{Renderer}) + name.vb: AddRenderers(IEnumerable(Of Renderer)) + fullName: UniGLTF.RuntimeGltfInstance.AddRenderers(System.Collections.Generic.IEnumerable) + fullName.vb: UniGLTF.RuntimeGltfInstance.AddRenderers(System.Collections.Generic.IEnumerable(Of Renderer)) + nameWithType: RuntimeGltfInstance.AddRenderers(IEnumerable) + nameWithType.vb: RuntimeGltfInstance.AddRenderers(IEnumerable(Of Renderer)) +- uid: UniGLTF.RuntimeGltfInstance.AddRenderers* + name: AddRenderers + href: api/UniGLTF.RuntimeGltfInstance.html#UniGLTF_RuntimeGltfInstance_AddRenderers_ + commentId: Overload:UniGLTF.RuntimeGltfInstance.AddRenderers + isSpec: "True" + fullName: UniGLTF.RuntimeGltfInstance.AddRenderers + nameWithType: RuntimeGltfInstance.AddRenderers - uid: UniGLTF.RuntimeGltfInstance.AnimationClips name: AnimationClips href: api/UniGLTF.RuntimeGltfInstance.html#UniGLTF_RuntimeGltfInstance_AnimationClips