일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- ability task
- listen server
- Multiplay
- photon fusion2
- gameplay ability system
- nanite
- 언리얼 엔진
- stride
- 게임 개발
- gameplay tag
- dirty cow
- MAC
- map design
- os
- 유니티
- CTF
- gas
- 게임개발
- Unreal Engine
- gravity direction
- animation
- local prediction
- rpc
- attribute
- UI
- 언리얼엔진
- unity
- gameplay effect
- Aegis
- Replication
- Today
- Total
Replicated
[Drag Down] Idle, Locomotion, Jump 본문


애니메이션 인스턴스 클래스 생성


애니메이션 블루프린트 생성
static ConstructorHelpers::FClassFinder<UAnimInstance> AnimInstanceClassRef(TEXT("/Game/Animation/ABP_Person.ABP_Person_C"));
if (AnimInstanceClassRef.Class)
{
GetMesh()->SetAnimInstanceClass(AnimInstanceClassRef.Class);
}
캐릭터 생성자에서 애니메이션 인스턴스 변경
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Animation/AnimInstance.h"
#include "DDAnimInstance.generated.h"
/**
*
*/
UCLASS()
class DRAGDOWN_API UDDAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
UDDAnimInstance();
protected:
virtual void NativeInitializeAnimation() override;
virtual void NativeUpdateAnimation(float DeltaSeconds) override;
// 상속받은 블루프린트에선 읽기만 하도록
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Character)
TObjectPtr<class ACharacter> Owner;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Character)
TObjectPtr<class UCharacterMovementComponent> Movement;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
FVector Velocity;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
float GroundSpeed;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
uint8 bIsIdle : 1;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
float MovingThreshold;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
uint8 bIsFalling : 1;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
uint8 bIsJumping : 1;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Character)
float JumpingThreshold;
};
// Fill out your copyright notice in the Description page of Project Settings.
#include "Animation/DDAnimInstance.h"
#include "GameFramework/Character.h"
#include "GameFramework/CharacterMovementComponent.h"
UDDAnimInstance::UDDAnimInstance()
{
MovingThreshold = 3.0f;
JumpingThreshold = 100.0f;
}
void UDDAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
Owner = Cast<ACharacter>(GetOwningActor());
if ( Owner )
{
Movement = Owner->GetCharacterMovement();
}
}
void UDDAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
Super::NativeUpdateAnimation(DeltaSeconds);
if (Movement)
{
Velocity = Movement->Velocity;
GroundSpeed = Velocity.Size2D();
bIsIdle = GroundSpeed < MovingThreshold;
bIsFalling = Movement->IsFalling();
bIsJumping = bIsFalling & (Velocity.Z > JumpingThreshold);
}
}
애니메이션 인스턴스

상속받은 변수 보이게 설정해주면

확인 가능
이제 AnimGraph 만들기

일단 Idle이랑 Locomotion 만들어야 함

근데 굳이 저 내부에서 작업하지 않고 외부에서 만들고 캐싱해두고 가져올 거임

노드 추가하고

기본 상태 + 세가지 상태 조합
* Idle -> IdleWalkRun

Idle 하지 않으면 전이
* Idle <- IdleWalkRun

Idle하면 Idle로 전이
아 근데 스켈레톤 잘못 지정해서 애니메이션 애셋이 안보인다..

이걸로 해야 한다..

애니메이션 블루프린트 만들면 종속되어서 새로 만들어야 한다..

이제 잘 보인다..
애니메이션 애셋 지정

애니메이션 넣어주기..

워크, 런은 블렌드스페이스 이미 있길래 그냥 쓰자

캐시로 만들기

로코모션

캐시한 거 가져다가 집어넣기
여기까지 하면 이제 걷고 뛰기는 끝


앨리어스랑 스테이트 만들고, 앨리어스는 로코 모션에서 넘어갈 수 있도록 설정



전이 조건이랑 애니메이션 애셋 넣어주고

점프에는 우선순위 높게 넣어주기
-> 점프랑 폴링 둘 다 만족 시 점프로 감


점프 애니메이션 10퍼센트 미만으로 남으면 폴링

다음은 착지 엘리어스


자연스럽게 로코모션이랑 섞어주기

조건 : 안떨어지고 있을 때

연결해주고

10퍼 미만으로 애니메이션 남으면 다시 로코 모션으로 가도록 설정

그리고 점프를 연속으로 하면 애니메이션 이상하길래 생각해보니
ToJump 앨리어스에 Land 추가해줘야 함
정상작동 확인
'언리얼 엔진 > Drag Down (캡스톤 디자인)' 카테고리의 다른 글
** [Drag Down] GAS Local Prediction ** with 밀기 애니메이션 (0) | 2025.03.26 |
---|---|
[Drag Down] 애니메이션 애셋 (0) | 2025.03.25 |
[Drag Down] 기본세팅 #2 : Attribute, PlayerState (0) | 2025.03.24 |
[Drag Down] 기본 세팅 #1 : Character Base, Player (0) | 2025.03.19 |
[Drag Down] Collision Setting (0) | 2025.03.19 |