-
04/15 유니티 애니메이션 컨트롤러 연습유니티 2021. 4. 16. 00:37
1. 캐릭터 모델을 Hierarchy에
2. 애니메이션 컨트롤러 스크립트를 생성하고 캐릭터에 컴포넌트 추가
3. 애니메이션 컨트롤러를 생성하여 캐릭터 모델에 추가
4. 애니메이터에서 blend tree 추가
5. blend tree에 모션 추가
AnimationControllerTest.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class AnimationControllerTest : MonoBehaviour { public float speed; private Animator anim; public Button btnReload; public Button btnDie; // Start is called before the first frame update void Start() { this.anim = this.GetComponent<Animator>(); this.btnReload.onClick.AddListener(() => { this.anim.SetTrigger("Reload"); }); this.btnDie.onClick.AddListener(() => { this.anim.SetTrigger("Die"); }); } // Update is called once per frame void Update() { this.anim.SetFloat("Move", this.speed); } }
'유니티' 카테고리의 다른 글
04/21 UI json데이터를 읽고 스테이지 정보 출력 (0) 2021.04.21 04/16 수업내용 메모 (0) 2021.04.16 04/15 유니티 LineRenderer 사용 연습 (0) 2021.04.15 04/15 유니티 화면 클릭으로 이동 구현 연습 (0) 2021.04.15 04/15 유니티 IK 연습 (0) 2021.04.15