API update

In VRM-1.0, Unity Component will be changed according to format update.

Load

VRM-1.0 can load VRM-0.X and run it on new components. In this case, use the VRM-0 license.

RuntimeGltfInstance instance = await VrmUtility.LoadAsync(path);

👇

Vrm10Instance vrm10Instance = await Vrm10.LoadPathAsync(path);

The design has changed from VRM-0.x to storing all information in Vrm10Instance.

It updates in a fixed order every frame.

  1. Control Rig

  2. Constraints

  3. Gaze control

  4. Expression

https://github.com/vrm-c/UniVRM/blob/master/Assets/VRM10/Runtime/Components/Vrm10Runtime/Vrm10Runtime.csharp#L170

Considering the posing and processing of the pose

  • [-2] Add a pose to ControlRig (Animator or original processing)

  • [-1] Fixed ControlRig. IK etc.

  • [1] Motion transfer from ControlRig application to main body

  • [2] Constraint resolution

  • [3] Gaze control solution

  • [4] Expression application

If you need control of the order, switch to manual updating of the VRMInstance and update manually.In that case, be careful to update SpringBone last.

Expression

VRMBlendShapeProxy is now Vrm10Instance.Runtime.Expression.

AccumulateValue have been into SetWeight.ImmediatelySetValue is gone.

var proxy = root.GetComponent<VRMBlendShapeProxy>();
proxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.A), 0.5f);

👇

var vrm10 = root.GetComponent<Vrm10Instance>();
vrm10.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(ExpressionPreset.aa), 0.5f);

LookAt

VRMLookAt is now Vrm10Instance.Runtime.LookAt.

vrm10.Gaze.position or vrm10.Runtime.LookAt.SetLookAtYawPitchPreviously updated values ​​are later applied by vrm10.Runtime.

Gaze

var lookAt = root.GetComponent<VRMLookAt>();
lookAt.LookWorldPosition(new Vector3(x, y, z));

👇

var vrm10 = root.GetComponent<Vrm10Instance>();
vrm10.LookAtTargetType = LookAtTargetTypes.CalcYawPitchToGaze;
vrm10.Gaze.position = new Vector3(x, y, z);

SetYawPitch

var lookAt = root.GetComponent<VRMLookAt>();
lookAt.ApplyRotations(yaw, pitch);

👇

var vrm10 = root.GetComponent<Vrm10Instance>();
vrm10.LookAtTargetType = LookAtTargetTypes.SetYawPitch;
vrm10.Runtime.LookAt.SetLookAtYawPitch(yaw, pitch);