0
0

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 3 years have passed since last update.

Animation Rigging で 握手モーションをろくろ回しモーションに作り変える

Last updated at Posted at 2020-04-04

Unityの公式動画でプロシージャルモーションを作る動画が配信されていたので試してみました。
gif_animation_001.gif

右下が元のアニメーション、中央が新しく作ったモーションになります。
腰にMuluti-Parent Constraintを、
両手にTwo Bone IK Constraintを使用しました。
ろくろアニメーション部分は、ベースとなるろくろピボットオブジェクト上に手のコントロールポイントピボットオブジェクトを置き、ろくろピボットオブジェクトをY,Zで適当に回しています。
gif_animation_002.gif
手の部分にも元のアニメーションを若干残すため、Weightを1より小さくしました。
2020-04-03_195646.png

動画の通りに両手のコントロールポイントを作成し、それをそのままろくろピボットオブジェクト上にのせてみたのですが、それではコントロールポイントがついてきてくれなかったため、ろくろピボットオブジェクトにスクリプトをアタッチし、手のコントロールポイントをピボットオブジェクトに追随させるようにしました。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace RokuroHand
{
    [System.Serializable]
    public class RokuroHandInfo{
        public Transform pivotTr;
        public Transform targetTr;
        public bool disablePosition;
    };

    public class RokuroHandCtrl : MonoBehaviour
    {
        [SerializeField] AnimationCurve m_acY=null;
        [SerializeField] AnimationCurve m_acZ = null;
        [SerializeField] RokuroHandInfo[] m_infoArr=null;
        float m_timer;

        // Start is called before the first frame update
        void Start()
        {
            m_timer = 0f;
        }

        // Update is called once per frame
        void Update()
        {
            m_timer += Time.deltaTime;
            float ty = m_acY.Evaluate((m_timer * 0.25f) %1f);
            float tz = m_acZ.Evaluate((m_timer * 0.33f) % 1f);
            transform.rotation = Quaternion.Euler(0f, ty * 200f, tz * 400f);

            foreach (RokuroHandInfo info in m_infoArr){
				if (!info.disablePosition){
                    info.targetTr.position = info.pivotTr.position;
                }
                info.targetTr.rotation = info.pivotTr.rotation;
            }
        }
    }
}

2020-04-03_200147.png

また、ろくろを回す際にIK制御の左腕が体にめり込んでいたのですが、空のオブジェクトを作成しHINTのところに入れ、適当なPositionを入れることでめり込まなくなりました。
2020-04-03_200627.png
2020-04-03_195646.png

他にもいろいろなプロシージャルモーションの例があるので、見てみると楽しいかと思います。
2020-04-03_201335.png
2020-04-03_201541.png

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?