Published on

Make your Vroid character dance [using Candy Rock Star, an official package from Unity Japan]

Authors
  • Evelyn

Please share this article if you like!

Hi, I'm Evelyn and full-time indiedev.

This time I found an interesting package distributed by Unity Japan, and I'll share it with you guys!

In this blog post, I'll show you how to make your Vroid 3D models dance in Unity with ease!

If you read this post all the way to the end, you'll see an implementation like the one in the video below, so make sure you read all the way through!

It is also explained in a Youtube video, so please watch the video and suffer if there are parts that are difficult to understand in the blog post alone.

Then let's develop it together!

Table of Contents

Importing packages

First, let's import the package we will be using into the project.

To use 3D models made by Vroid in Unity, we use a package called UniVRM.

Github of UniVRM

Next, download the Unity-Chan "Candy Rock Star" Public Repository distributed by Unity Japan.

Github of Unity-Chan "Candy Rock Star" Public Repository

Rename the Assets folder in unitychan-crs to whatever you want, and drag and drop it under the assets folder of your own project.

Furthermore, import the UniVRM unitypackage file into the project by dragging and dropping it.

As a final step in this section, we will drag and drop the VRM file into Unity and import the Vroid 3D model into Unity.

Setting up the scene

Now it's time to set up the Scene!

Double-click on the Vroid model prefab to edit it.

And then, create an empty game object and rename it to Character1_Head.

Then, move its position to around the character's head.

Then, as before, create an empty game object and rename it Camera Target.

Then, move its position to the chest area of the character.

And change the tag to FocusObj.

Next, create a directional light and change the intensity to 2.

This will make the character appear brighter on the stage.

Then, change the Controller of the Animator component of the character to MocapC86.

We’ll also add Face Update and Music Starter to the character's game object.

Once you've finished editing your character, there's just a little more work to do! Let's work together to finish this thing!

Search for lipsync in the project window and double-click on the script file that appears to edit it.

Search for lipsync in the project window and double-click on the script file that appears to edit it.

LipSyncController

using UnityEngine;
using System.Collections;
using VRM; // added

public class LipSyncController : MonoBehaviour
{
    public string targetName;

    public Transform nodeA;
    public Transform nodeE;
    public Transform nodeI;
    public Transform nodeO;
    public Transform nodeU;

    public AnimationCurve weightCurve;

    VRMBlendShapeProxy target; // modified

    void Start()
    {
        target = GameObject.Find(targetName).GetComponent<VRMBlendShapeProxy>(); // modified
    }

    float GetWeight(Transform tr)
    {
        return weightCurve.Evaluate(tr.localPosition.z);
    }

    [System.Obsolete]
    void LateUpdate()
    {
        var total = 1.0f; // modified

        var w = total * GetWeight(nodeA);
        target.ImmediatelySetValue(BlendShapePreset.A, w); // modified
        total -= w;

        w = total * GetWeight(nodeI);
        target.ImmediatelySetValue(BlendShapePreset.I, w); // modified
        total -= w;

        w = total * GetWeight(nodeU);
        target.ImmediatelySetValue(BlendShapePreset.U, w); // modified
        total -= w;

        w = total * GetWeight(nodeE);
        target.ImmediatelySetValue(BlendShapePreset.E, w); // modified
        total -= w;

        w = total * GetWeight(nodeO);
        target.ImmediatelySetValue(BlendShapePreset.O, w); // modified

        target.Apply(); //added
    }
}

Then, double-click the LipSyncController prefab on the left side of the script file to edit it and change the Target Name to YOUR_VROID_NAME(Clone).

My character's name is Evelyn, so I'll change it to Evelyn(Clone) and

Finally, open the Main Scene from the scene folder and change the first Prefabs On Timeline in the Stage Director to the prefabs of your Vroid model, and you are all set.

Conclusion

Once you have done this, run Unity and the dance video should play.

How was it? I think it's great to be able to create a powerful stage with such a simple process.

What is unitychan-crs?

This asset allows us to easily create a live stage.

You are welcome to modify this package in your own way to create your own live stage.

Thank you for reading to the end.

Please share this article if you like!