예제 #1
0
    // Use this for initialization
    void Start()
    {
        var path    = Application.streamingAssetsPath + "/" + "AliciaSolid.vrm";
        var context = new VRMImporterContext();

        context.Parse(path);
        context.LoadAsync(() =>
        {
            var avatar = context.Root;
            avatar.transform.parent = this.transform;

            foreach (var t in avatar.transform.Decendants())
            {
                t.gameObject.layer = AvatarLayer;
            }

            // Set Avatar to System
            var blendShapeClipChanger = GetComponentInChildren <BlendShapeClipChanger>();
            blendShapeClipChanger.VRM = avatar.GetComponent <VRMBlendShapeProxy>();

            var vrmLipSync             = GetComponentInChildren <OVRLipSyncVRMTarget>();
            vrmLipSync.BlendShapeProxy = avatar.GetComponent <VRMBlendShapeProxy>();

            var vrikProvider    = GetComponentInChildren <VRIKProvider>();
            vrikProvider.Avatar = avatar;
            vrikProvider.CallSetUp();

            context.ShowMeshes();
        });
    }
예제 #2
0
    void ImportVRM(string path)
    {
        if (VRM != null)
        {
            Destroy(VRM);
        }

        var context = new VRMImporterContext();

        context.Parse(path);
        context.LoadAsync(() =>
        {
            var gameObject = context.Root;
            gameObject.transform.position    = new Vector3(0, 0, 0);
            gameObject.transform.eulerAngles = new Vector3(0, 180, 0);

            context.ShowMeshes(); // メッシュの表示・ここ重要

            ExportVCI.VRM = gameObject;

            Description.SetActive(false);

            VRM = gameObject;
        });
    }