강의

멘토링

로드맵

Inflearn brand logo image

인프런 커뮤니티 질문&답변

Tae In Kim님의 프로필 이미지
Tae In Kim

작성한 질문수

[Unity6] 나만의 서바이벌 게임 만들기

Character Movement

character movement 반응속도

해결된 질문

작성

·

110

0

move에 대한 animator 작업도 진행하고 코드작업도 진행을 했는데요.

처음 게임 시작누르고 방향키를 한 2~3초눌러야 run상태로 가더라고요. idle상태는 그거보단 빠른 1초정도?

어떤게 문제일까요..
condition에서 스피드에 대한 값도 지정해서 0.1 0.01까지 낮춰보았고, setting에서 exit time과 transition duration까지 낮춰보면서 해봤는데 안되네요.
음 좀 보는데 idle에서 모션변환까지 duration이 좀 걸리는거같은데요..

void Move()
{
    // key 방향
    float horizontal = Input.GetAxis("Horizontal");
    float vertical   = Input.GetAxis("Vertical");

    Vector3 cameraForward = Camera.main.transform.forward;
    Vector3 cameraRight   = Camera.main.transform.right;

    cameraForward.y = 0.0f;
    cameraRight.y   = 0.0f;

    cameraForward.Normalize();
    cameraRight.Normalize();

    Vector3 moveDirection = cameraRight * horizontal + cameraForward * vertical;
    
    // mobile, pc 속도 차이 줄이기위해 
    controller.Move(moveDirection * moveSpeed * Time.deltaTime);

    // moveDirection.magnitude를 좀 더 빠르게 반영하도록
    float currentSpeed = moveDirection.magnitude * moveSpeed;
    animator.SetFloat("a_Speed", currentSpeed);
}

 

 

답변 2

0

Pinous님의 프로필 이미지
Pinous
지식공유자

해결이 되셨다니 다행입니다 🙂 !

0

Tae In Kim님의 프로필 이미지
Tae In Kim
질문자

해결완료.. exit time 없앴습니다.

Tae In Kim님의 프로필 이미지
Tae In Kim

작성한 질문수

질문하기