HarmonicMotion

[Last update: 01/30/2020]

Summary

HarmonicMotion is a function that periodically iterates the values of specified parameters.
It is used primarily for things that are in constant motion, such as breathing.
For more information on how to set up HarmonicMotion, please click here.

HarmonicMotion in Cubism SDK for Unity consists of two elements.

  1. Components for specifying parameters to operate
  2. Components that manipulate the value of each parameter

 

1. Components for specifying parameters to operate

Use CustomHarmonicMotionParameter to specify the parameters to be used for HarmonicMotion.

The CustomHarmonicMotionParameter is a component that inherits from MonoBehaviour and
attaches to GameObjects placed under [Prefab root]/Parameters/.
It will cycle through the values of the parameters with the same ID as the GameObject to which it is attached.

The CustomHarmonicMotionParameter has five setting items.

  • Channel

Specifies the multiplier for the sine wave period set by the CubismHarmonicMotionController.
HarmonicMotion allows multiple periods for a single model, which can be set with the CustomHarmonicMotionController.
Here, set the index of the CustomHarmonicMotionController.ChannelTimescales.

  • Direction

Sets the range of periodic operation with respect to the center of the parameter.
There are three setting items.

- Left : It works only in the left half of the range from the center of the parameter.
- Right :  It works only in the right half of the range from the center of the parameter.
- Centric :  It works across the entire range of parameters.

  • NormalizedOrigin

Sets the center of the parameter to be referenced by Direction.
The minimum value of that parameter is set to 0 and the maximum value is set to 1.

  • NormalizedRange

Sets the amplitude at which to operate the value from the center of the value set in NormalizedOrigin.
Set the distance traveled from the center when the minimum value of that parameter is 0 and the maximum value is 1.
This value can only range from the center position set by NormalizedOrigin to the minimum or maximum value of the parameter.

  • Duration

Adjusts the period of the parameter.

 

The CustomHarmonicMotionParameter is also used as a marker for the CustomHarmonicMotionController to obtain references.

 

2. Components that manipulate the value of each parameter

Use the CustomHarmonicMotionController to apply opening and closing values to each parameter.
This is a component that inherits from MonoBehaviour and attaches to the root of Cubism's Prefab when used.

At initialization, obtains a reference to all CubismHarmonicMotionParameters attached to the Prefab.
If you add/remove a parameter whose value is to operate cyclically during execution, call CustomHarmonicMotionController.Refresh() to retrieve the reference again.

 

The CustomHarmonicMotionController applies the calculated values for the parameters marked by CustomHarmonicMotionParameter at the time of LateUpdate() each frame.

 

The CustomHarmonicMotionController has two setting items.

  • BlendMode

Blend mode for applying values to parameters.
The following three values can be set.

- Override : Overwrites the current value.
- Additive : Add to current value.
- Multiply : Multiply by the current value.

  • ChannelTimescales

Sets the period of the sine wave.
Multiple cycles can be set.

© 2010 - 2022 Live2D Inc.