์ฐ์ ์ ๋๋ฉ์ด์ ์ด ์ ์ฉ๋๋ ๋ชจ๋ธ์ ๊ตฌํ๊ณ
Animator ํด๋๋ฅผ ํ๋ ๋ง๋ค์ด์ ๊ทธ ์์ Animator Controller๋ฅผ ์์ฑ
ํ์ผ ์ด๋ฆ์ MainAnimator
ํ์ผ์ ๋๋ฒ ํด๋ฆญํ๋ฉด ํ๋ฉด์ ์ ๋๋ฉ์ด์ ๋ค์ ์ปจํธ๋กคํ ์ ์๋ ์ปจํธ๋กค ์ฐฝ์ ๋จ๊ฒ ํ๋ค.
์ ๊ณณ์๋ค ์ฌ๋ฌ ์ ๋๋ฉ์ด์ ๊ฐ์ฒด๋ค์ ๋์ฌ ๋น๊ฒจ์ ์ฐ๊ฒฐ์ ์์ผ์ฃผ๋ฉด ๋๋ค.
์ ํ ํ์ WAIT01 ์ ๋๋ฉ์ด์ ์ด ์๋ํ๊ฒ ์ฐ๊ฒฐํด์ค
๊ทธ๋ฆฌ๊ณ ๋ค์ ์บ๋ฆญํฐ ๋ชจ๋ธ์ Inspector์ ํ์ธํด Animator ์ปดํฌ๋ํธ์ Controller๋ฅผ ์๊น ์์ฑํด์ ์ค์ ํ MainAnimator๋ฅผ ์ ์ฉ.
์ด์ ์คํฌ๋ฆฝํธ๋ฅผ ์จ์ค๋ค.
[Main Controller.cs]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainController : MonoBehaviour
{
public Animator animator;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
if( Input.GetKeyDown(KeyCode.Space) ){
animator.Play("JUMP00", -1, 0);
}
}
}
์คํ์ด์ค๋ฐ๋ฅผ ๋๋ฅด๋ฉด animator.Play๋ฅผ ์๋์์ผ "JUMP00"์ด๋ผ๋ ๋์์ ํ๋๋ก ์ํจ๋ค.
์ถ์ฒ:
https://www.youtube.com/watch?v=8PO48QvedV8&ab_channel=%EB%8F%99%EB%B9%88%EB%82%98
'๐จ๐ผโ๐ป๊ฐ๋ฐ > ์ ๋ํฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ ๋ํฐ - ์นด๋ฉ๋ผ ํ๋ ์ด์ด์๊ฒ ๊ณ ์ ํ๊ธฐ (0) | 2021.11.28 |
---|---|
์ ๋ํฐ - ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ ์์น ์ด๋ (0) | 2021.11.28 |