[유니티 입문 강좌] part8 애니메이션

kkily·2021년 11월 20일
0

녹화버튼 누르면 움직임 녹화
한 간격당 1분
samples는 1초에 몇프레임을 실행하냐

  • element: 애니메이션을 하는 애
  • play automatically: play 시작하자마자 큐브 1에있는 애니메이션을 재생
  • Amimate Physics: 애니메이션에도 물리를 넣겠다
  • Culling Type: 카메라의 시야를 벗어나면 안보임

  • Loop은 왔다갔다 계속 진행
  • Pingpong은 마지막 프레임이 되면 마지막 프레임이 첫 프레임이 됨
  • clamp forever은 마지막 프레임 멈춘상태로 가만히 있음
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Text_chap8 : MonoBehaviour
{
    private Animation anim;
    private AnimationClip clip;

    // Start is called before the first frame update
    void Start()
    {
        anim=GetComponent<Animation>();
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.W)){ //w키 누르면 
            anim.Play("Cube_2"); //cube2라는 애니메이션 실행
            anim.PlayQueued("Cube_2");// 끝나면 cube2 실행
            anim.Blend("Cube_2"); // 애니메이션 cube1과 2가 섞임
            anim.crossFade("Cube_2"); //실행하던 것이 자연스럽게 사라지고 2가 실행
            if(!anim.IsPlaying("Cube_2"))
                anim.Play("Cube_2");
            anim.Stop(); //정지
            anim.wrapMode=WrapMode.Loop; //랩모드 변경
            anim.clip=clip;
            anim.animatePhysics=false;


        }
        
    }
}
profile
낄리의 개발 블로그╰(*°▽°*)╯

0개의 댓글