본문 바로가기
[ CODING STUDY ]/》언리얼엔진5 실습

언리얼엔진5 c++ Camera SpringArm

by MRG 2024. 4. 14.
728x90
반응형

 

▣ UPROPERTY() : 변수에 붙은 리플렉션 매크로

 

▣ 에디터 접근을 위한 매크로

 

https://dev.epicgames.com/documentation/ko-kr/unreal-engine/unreal-engine-uproperties?application_version=5.3

 

언리얼 엔진 UProperty

게임플레이 클래스에 대한 프로퍼티 생성 및 구현 관련 레퍼런스입니다.

dev.epicgames.com

 

 

▣ SpringArm, Camera 컴포넌트를 사용하기 위한 헤더 추가

#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"

 

 

▣ CreateDefaultSubobject<컴포넌트>(컴포넌트 이름) : 구성 요소 또는 하위 객체를 생성하면 하위 클래스를 생성하고 상위 클래스를 반환

 

▣ 언리얼 엔진에서의 UObject는 오브젝트 프로토입을 기본으로 합니다. 각 UClass는 UObject와 연관된 CDO(Class Default Object)라고 불리는 디폴트 인스턴스를 갖습니다. 이 인스턴스는 엔진이 초기화될 때 클래스 생성자를 통해 최초로 단 한번 할당됩니다. 이후에 생성자는 절대로 다시 불려지지 않고 새로운 UObject를 생성 시 복사를 생성합니다.


이것이 의미하는 것은 UObject 생성자는 어떠한 런타임 로직을 포함할 수 없다는 것입니다. 

만약 Actor Component와 같은 서브 오브젝트들을 포함하고 있는 오브젝트라면, 이러한 디폴트 오브젝트들은 처음에 생성되어야 합니다. 

UObject::CreateDefaultSubobject
UObject의 생성자에서만 호출합니다. 무엇보다도 서브오브젝트 클래스의 CDO 인스턴스 생성합니다. 생성된 오브젝트는 해당 오브젝트 클래스가 인스턴스화될 때 속성의 기본 오브젝트가 됩니다.

 

https://cafe.naver.com/unrealenginekr/13885

 

[C++ 기초5] 클래스 기본 객체 (Class Default Object)

안녕하세요 여러분~이번 강좌에서는 하나의 모듈에서 다른 모듈을 참조하는 기능을 구현해보겠습니다. 모듈간의 참조를 구현하기 위해서는 우선 언리얼 오브젝트의 초기화 과정에 대한 ...

cafe.naver.com

 

 

https://docs.unrealengine.com/4.26/en-US/API/Runtime/CoreUObject/UObject/UObject/CreateDefaultSubobject/2/

 

UObject::CreateDefaultSubobject

Create a component or subobject, allows creating a child class and returning the parent class.

docs.unrealengine.com

 

 

▣ SetupAttachment(컴포넌트) : 지정한 컴포넌트에 상속

 

https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/Components/USceneComponent/SetupAttachment/

 

USceneComponent::SetupAttachment

Initializes desired Attach Parent and SocketName to be attached to when the component is registered.

docs.unrealengine.com

 

 

▣ 빌드 후 블루프린트를 확인하면 SpringArm에 Camera가 상속되어 있는 걸 확인할 수 있습니다. 

 

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/Camera/UCameraComponent?application_version=5.3

 

UCameraComponent

Represents a camera viewpoint and settings, such as projection type, field of view, and post-process overrides.

dev.epicgames.com

 

https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/Engine/GameFramework/USpringArmComponent?application_version=5.3

 

USpringArmComponent

This component tries to maintain its children at a fixed distance from the parent, but will retract the children if there is a collision, and spring bac...

dev.epicgames.com

 

 

728x90
반응형

댓글