1. 리비전컨트롤 연결 후, 버전별로 변경사항 확인 가능.
연결 -> 제공자 Subversion -> 루트 지정하고 사용자명/비밀번호 입력하면 연결됨
(1) 버전비교를 통해 보면 버전별로 블루프린트 비교 가능
2. enum을 통해 애니메이션 블론드하는 방법, 다른방식으로 캐릭터 움직이기
1) PlayerBase.MoveAction()에 virtual 키워드 추가
UFUNCTION()
virtual void MoveAction( const struct FInputActionValue& value );
2) Actors 폴더에 PlayerBase상속받는 PlayerQueen 클래스 추가
header
public :
APlayerQueen ();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay () override;
public:
// Called every frame
virtual void Tick ( float DeltaTime ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent ( class UInputComponent* PlayerInputComponent ) override;
virtual void MoveAction ( const struct FInputActionValue& value ) override;
cpp
#include "InputActionValue.h"
APlayerQueen::APlayerQueen ()
{
PrimaryActorTick.bCanEverTick = true;
USkeletalMeshComponent* meshCp = GetMesh ();
if ( !IsValid ( meshCp ) )
return;
static ConstructorHelpers::FObjectFinder<USkeletalMesh>
mesh ( L"/Script/Engine.SkeletalMesh'/Game/ParagonAurora/Characters/Heroes/Aurora/Skins/GlacialEmpress/Meshes/Aurora_GlacialEmpress.Aurora_GlacialEmpress'" );
if ( mesh.Succeeded () )
meshCp->SetSkeletalMeshAsset ( mesh.Object );
meshCp->SetRelativeLocation ( FVector ( 0, 0, -90 ) );
meshCp->SetRelativeRotation ( FRotator ( 0, -90, 0 ) );
//static ConstructorHelpers::FClassFinder<UAnimInstance>
// anim ( L"/Script/Engine.AnimBlueprint'/Game/Blueprint/Animation/BPA_AnimKnight.BPA_AnimKnight_C'" );
//if ( anim.Succeeded () )
// meshCp->SetAnimInstanceClass ( anim.Class );
// bOrientRotationToMovement : 이동방향으로 회전시키기
GetCharacterMovement ()->bOrientRotationToMovement = true;
GetCharacterMovement ()->bUseControllerDesiredRotation = false;
// RotationRate : 회전속도
GetCharacterMovement ()->RotationRate = FRotator ( 0.f, 500.f, 0.f );
// 컨트롤러의 회전을 캐릭터에 전달여부
// bUseControllerRotationPitch : 컨트롤러에서 rotation pitch를 받을지 여부
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// 상속 안받음
mArm->bInheritPitch = false;
mArm->bInheritYaw = false;
}
void APlayerQueen::BeginPlay ()
{
Super::BeginPlay ();
}
void APlayerQueen::Tick ( float DeltaTime )
{
Super::Tick ( DeltaTime );
}
void APlayerQueen::SetupPlayerInputComponent ( UInputComponent* PlayerInputComponent )
{
Super::SetupPlayerInputComponent ( PlayerInputComponent );
}
void APlayerQueen::MoveAction ( const FInputActionValue& value )
{
FVector axis = value.Get<FVector> ();
const FRotator rotation = Controller->GetControlRotation ();
const FRotator yawRot = FRotator ( 0.f, rotation.Yaw, 0.f );
// 전방 벡터
FVector forward = FRotationMatrix ( yawRot ).GetUnitAxis ( EAxis::X );
// 우측 벡터
FVector right = FRotationMatrix ( yawRot ).GetUnitAxis ( EAxis::Y );
AddMovementInput ( forward, axis.X );
AddMovementInput ( right, axis.Y );
}
-> 실행하면 앞,뒤,좌,우 방향키를 누를때마다 해당 키의 방향으로 회전하여 이동하게 됨..
좌 키를 누르면 왼쪽으로 회전후 계속 이동 하는 방식으로
3. Define 만들기
-> EAnimType을 통해 애니메이션 재생시키자
(1) Common폴더에, 아무것도 상속받지 않은 Define 클래스 생성
▶️ 언리얼 enum 기본 형식
UENUM( BlueprintType )
enum class EAnimType : uint8
{
ANIMTYPE_IDLE UMETA( DisplayName = "Idle" ),
ANIMTYPE_WALK UMETA( DisplayName = "Walk" ),
ANIMTYPE_END UMETA( DisplayName = "End" ),
};
- DisplayName = "Idle" : 블루프린트에서 보는 이름
#include "EngineMinimal.h"
UENUM( BlueprintType )
enum class EAnimType : uint8
{
ANIMTYPE_IDLE UMETA( DisplayName = "Idle" ),
ANIMTYPE_WALK UMETA( DisplayName = "Walk" ),
ANIMTYPE_END UMETA( DisplayName = "End" ),
};
class RESTART0501_API Define
{
public:
Define();
~Define();
};
(2) AnimBase에 적용
header
#include "../Common/Define.h"
..
UPROPERTY( VisibleAnywhere, BlueprintReadOnly )
EAnimType mAnimType;
..
UFUNCTION()
void SetAnimType( EAnimType animType );
(2) 애니메이션 생성해보자
-> Locomotion쓰지않는 방식으로
1) 블프/animation 폴덩에서 - 애니메이션 - 애니메이션 블루프린트 - 스켈레톤 선택 - AnimBase를 부모클래스 선택
- BPA_AnimQueen 생성
2) BPA_AnimQueen 에디터에서
Blend Poses (EAnimType) 추가
3) Blend Poses 선택하고 Idle, Walk 애니 타입 추가, output pose와 연결
4) BlendPoses의 기본포즈를 에셋 브라우저에서 idle 애니 가져와서 연결
idle Pose와 Walk Pose에도 애니메이션 연결
애니 세개 모두 애니메이션 루프 체크
5) 퀸 캐릭터의 애니메이션 연결하기
(1) BPA_AnimQueen의 레퍼런스 복사 후, PlayerQueen 생성자내 애니메이션에 연결
// 생성자
{
static ConstructorHelpers::FClassFinder<UAnimInstance>
anim ( L"/Script/Engine.AnimBlueprint'/Game/Blueprint/Animation/BPA_AnimQueen.BPA_AnimQueen_C'" );
if ( anim.Succeeded () )
meshCp->SetAnimInstanceClass ( anim.Class );
}
void APlayerQueen::MoveAction ( const FInputActionValue& value )
{
..
mAnim->SetAnimType( EAnimType::ANIMTYPE_WALK );
}
=> 실행하면 Idle 애니가 실행
'Unreal Engine5 > KDT 2024' 카테고리의 다른 글
[UE5 KDT2024] 22. 열거형 애니메이션 동기화 (0) | 2025.03.06 |
---|---|
[UE5 KDT2024] 21. 애니메이션 블랜드 2 - 열거형 이용 (0) | 2025.03.05 |
[UE5 KDT2024] 19. 에임오프셋 (0) | 2025.03.03 |
[UE5 KDT2024] 18. 애니메이션 동기화 (0) | 2025.03.02 |
[UE5 KDT2024] 17. 애니메이션 몽타주2 (0) | 2025.03.01 |
댓글