728x90
1. Animator 창에서 우클릭

2. motion 추가

3. 2개의 합성된 애니메이션 사용시 조절 파라미터 생성

4. 합성 애니메이션 소스에서 호출 (Mathf.Lerp는 부드러운 움직임을 위해)
if (_moveToDest)
{
wait_run_ratio = Mathf.Lerp(wait_run_ratio, 1, 10.0f * Time.deltaTime);
Animator anim = GetComponent<Animator>();
anim.SetFloat("wait_run_ratio", wait_run_ratio);
anim.Play("WAIT_RUN");
}
else
{
wait_run_ratio = Mathf.Lerp(wait_run_ratio, 0, 10.0f * Time.deltaTime);
Animator anim = GetComponent<Animator>();
anim.SetFloat("wait_run_ratio", wait_run_ratio);
anim.Play("WAIT_RUN");
}728x90
'Unity' 카테고리의 다른 글
| [Unity][방법] 애니메이션 파라미터 조건으로 사용하기 (0) | 2022.10.06 |
|---|---|
| [Unity][방법] Status패턴 방법 (2) | 2022.10.06 |
| [Unity][팁] 유용한 Math함수 (0) | 2022.10.05 |
| [Unity][팁] transform.LookAt을 사용하여 오브젝트가 나를 바라보도록 (0) | 2022.10.05 |
| [Unity][방법] Object충돌(Collision)_4 RayerMask 사용하기 (0) | 2022.10.05 |