반응형
- Blend Shape이란?
스킨드 매쉬 랜더러 애니메이션을 적용하고 싶을때 사용
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
SkinnedMeshRenderer skinnedMeshRenderer;
private void Awake()
{
skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
}
private void OnEnable()
{
StartCoroutine(SetBlendShapeCoroution(skinnedMeshRenderer));
}
private void OnDisable()
{
StopAllCoroutines();
}
IEnumerator SetBlendShapeCoroution(SkinnedMeshRenderer mesh)
{
float blend = 0;
while (blend < 100)
{
blend += 1f;
mesh.SetBlendShapeWeight(0, blend);
yield return new WaitForSeconds(0.01f);
}
mesh.SetBlendShapeWeight(0, 100);
}
}
반응형