본문 바로가기
유니티 프로젝트/Team Project1 - Fall Guys

폴가이즈 _ 3D 모델 / 애니메이션 (참고)

by SUGI_ 2022. 7. 12.

https://chameleonstudio.tistory.com/26

 

유니티 KeyCode 종류 알아보기

f해당 티스토리 페이지는 필자가 유니티 C# 개발을 하면서 학습한 내용들을 기록하고 공유하는 페이지입니다 ! - 틀린 부분이 있거나, 수정된 부분이 있다면 댓글로 알려주세요 ! - 해당 내용을

chameleonstudio.tistory.com

https://youtu.be/GDcWPOVMP54

  • 우리가 원하는 타이밍에 애니메이션 전환
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LHS_PlayerController : MonoBehaviour
{
    private Animator animator;

    private void Awake()
    {
        animator = GetComponent<Animator>();
    }
    
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            animator.Play("Dance01");
        }
        
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            animator.Play("Dance02");
        }

        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            animator.Play("Victory01");
        }
    }
}
  • 상태 전의를 이용한 애니메이션 전환 (Transition)

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LHS_PlayerController : MonoBehaviour
{
    private Animator animator;

    private void Awake()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        Expression();

        Run();

  
    }

    void Expression()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            animator.Play("Dance01");
        }

        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            animator.Play("Dance02");
        }

        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            animator.Play("Victory01");
        }
    }

    void Run()
    {
        if(Input.GetKeyDown(KeyCode.Alpha4))
        {
            animator.SetFloat("moveSpeed", 0.0f);
        }

        else if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            animator.SetFloat("moveSpeed", 5.0f);
        }
    }
}

https://youtu.be/WkMM7Uu2AoA

 

1. 이동하고 싶다.

- Rigidbody / Capsule collider / 이동 스크립트

- trnasform 이동은 물리 충돌을 무시하는 경우가 발생함 -> 그래서 (사진2) 체크

(사진1) 이동스크립트
(사진2) Collision Detection 빠르게 움직이는 오브젝트가 충돌의 감지 없이 다른 오브젝트를 지나쳐가는 것을 방지합니다.

 2. 애니메이션 추가

Animator Controller

3. 카메라

https://hub1234.tistory.com/21

728x90

'유니티 프로젝트 > Team Project1 - Fall Guys' 카테고리의 다른 글

폴가이즈 _ 리스폰,UI (참고)  (0) 2022.07.16
Fall Guys - Alpha  (0) 2022.07.12
Fall Guys - Prototype  (0) 2022.07.10
폴가이즈 _ 움직임  (0) 2022.07.10
폴가이즈 _ 장애물 추  (0) 2022.07.09