VRCharacter.h
C++로 안되는 이유 VRPawn을 보면 VROrigin이 있다.
C++에서 VROrigin을 만들어 준다.
VRCharacted.h
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite ,Category = "HMD")
class UCameraComponent* CameraComp;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HMD")
class USceneComponent* VROrigin;
VRCharacter.cpp
#include "Components/SceneComponent.h"
AVRCharacter::AVRCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
VROrigin = CreateDefaultSubobject<USceneComponent>(TEXT("VROrigin"));
SetRootComponent(VROrigin);
GetMesh()->SetupAttachment(RootComponent);
GetArrowComponent()->SetupAttachment(RootComponent);
GetCapsuleComponent()->SetupAttachment(RootComponent);
GetCapsuleComponent()->SetCapsuleSize(1.f, 1.f);
LeftController = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("LeftCon"));
LeftController->MotionSource = FName("Left");
LeftController->SetupAttachment(RootComponent);
RightController = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("RightCon"));
RightController->MotionSource = FName("Right");
RightController->SetupAttachment(RootComponent);
CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("HMD"));
CameraComp->SetupAttachment(RootComponent);
}
'언리얼수업 > 언리얼' 카테고리의 다른 글
VR C++캐릭터 만들기 정리 (1) | 2023.12.18 |
---|---|
231218 VRPawn 복제 안움직이는 이 (0) | 2023.12.18 |
231218 VR수업 (0) | 2023.12.18 |
231218 Unreal VR Site (1) | 2023.12.18 |
C++ Oculus Touch(Motion Controller)를 포함한 Pawn 생성하기 (0) | 2023.12.18 |