Created
October 27, 2019 10:53
-
-
Save DenchiSoft/d215d1357ac9fb1bb238d225cc825789 to your computer and use it in GitHub Desktop.
Minimal Live2D parameter manipulation example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Live2D.Cubism.Core; | |
using Live2D.Cubism.Framework; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class L2DTest : MonoBehaviour | |
{ | |
[Range(-30, 30)] | |
public float paramValue; | |
private CubismModel model; | |
private Dictionary<string, CubismParameter> parameters = new Dictionary<string, CubismParameter>(); | |
void Start() | |
{ | |
model = transform.FindCubismModel(); | |
foreach (CubismParameter parameter in model.Parameters) | |
{ | |
// Alternatively, use parameter.name | |
parameters.Add(parameter.Id, parameter); | |
} | |
} | |
void LateUpdate() | |
{ | |
parameters["ParamAngleX"].BlendToValue(CubismParameterBlendMode.Override, paramValue); | |
parameters["ParamAngleY"].BlendToValue(CubismParameterBlendMode.Override, paramValue); | |
parameters["ParamAngleZ"].BlendToValue(CubismParameterBlendMode.Override, paramValue); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment