2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Unity] VRIK(FinalIK)のInspectorの値をスクリプトから変更する

Last updated at Posted at 2019-11-22

やり方

スクリプトを作成し、using RootMotion.FinalIK; を宣言します。

例えば、自身にAddComponentしたVRIKを参照してIK全体のweightを変更する場合、以下のように記述します。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RootMotion.FinalIK;

public class IKChange : MonoBehaviour
{
    VRIK VRIKscript;//スクリプト

    void Start()
    {
        VRIKscript = gameObject.GetComponent<VRIK>();
        //weightの値変更
        VRIKscript.solver.IKPositionWeight = 0.5f;
    }
}

キャプチャ3.PNG
できた!

詳しく

Inspectorから操作できるVRIK(Script)のあれこれはnamespaceとして用意してあるため、宣言するだけで簡単に扱えます。扱える変数等は公式のリファレンスから。
IKのweightを徐々に小さくしていくことで、モーションデータからアニメーションのモーフィングができるはずです(試していません)。また、VRMをランタイムで読み込んでVRIKをアタッチさせるなんてことも可能だそう。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?