Help us understand the problem. What is going on with this article?

プロ生ちゃん3Dモデルの表情を座標値で操作

More than 1 year has passed since last update.

概要

プロ生ちゃん3Dモデル
http://3d.nicovideo.jp/works/td8608
の表情を以下の手法で操作します。
http://udasankoubou.blogspot.jp/2017/07/undebuggable-rittai-chan.html
※超絶簡易版として実装します。

bandicam-2017-12-05-00-24-56-519.gif
><がちょっと変ですけど組み合わせ吟味すれば少し良くなるハズ……

スクリプト

using UnityEngine;

public class ChangeFace : MonoBehaviour
{
    [SerializeField]
    SkinnedMeshRenderer skinn;

    [SerializeField]
    int up;

    [SerializeField]
    int down;

    [SerializeField]
    int left;

    [SerializeField]
    int right;

    void Update()
    {
        Vector2 stick = OVRInput.Get(OVRInput.RawAxis2D.RThumbstick) * 100;

        skinn.SetBlendShapeWeight(up, stick.y);
        if (stick.y < 0)
        {
            skinn.SetBlendShapeWeight(down, -stick.y);
        }

        skinn.SetBlendShapeWeight(right, stick.x);
        if (stick.x < 0)
        {
            skinn.SetBlendShapeWeight(left, -stick.x);
        }
    }
}

設定

プロ生ちゃんの表情設定はここにまとまってるみたいです。
ここで値を調整しながら上下左右に割り当てるindex(上から順に0から気合で数える。)を決めます。
「まばたき」と「笑い」のように一緒にすると変になる組み合わせは上下または左右に割り当てると操作時に自然です。
00.png

割り当てるindexが決まったら、SkinnにSkinnedMeshRendererが付いてるObjectを割り当て、上下左右にindexの値を設定します。
01.png

※今回のスクリプトは1つで上下左右4つなので、目と眉と口で3つ付けると表情がはっきりします。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away