[C++] 총 메쉬 붙이기

Woogle·2022년 11월 21일
0

언리얼 엔진 5

목록 보기
29/59

📄 헤더

	UPROPERTY(EditAnywhere, BlueprintReadOnly)
	class USkeletalMeshComponent* gunMeshComp;

📄 소스

ATPSPlayer::ATPSPlayer()
{
	// ...

	// 총 메쉬 설정
	gunMeshComp = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("gunMeshComp"));
	gunMeshComp->SetupAttachment(GetMesh());

	// 총 에셋 찾아오기
	ConstructorHelpers::FObjectFinder<USkeletalMesh> tempGunMesh(TEXT("SkeletalMesh'/Game/Resources/FPWeapon/Mesh/SK_FPGun.SK_FPGun'"));

	// 총 에셋 적용
	if (tempGunMesh.Succeeded())
	{
		gunMeshComp->SetSkeletalMesh(tempGunMesh.Object);
		gunMeshComp->SetRelativeLocation(FVector(0, 40, 140));
	}
}
profile
노력하는 게임 개발자

0개의 댓글