TIL - Today I Learned : Loosely coupled
오늘의 진도: Section 4: Crypt Raider 77. Character Blueprint ~ 79. C++ Actor Component
Character Blueprint
바닥을 뚫고 캐릭터가 떨어지는걸 방지해보도록 하자
Floor를 더블클릭하여 Static Mesh Editor를 열어 Collision를 추가한다.
Details -> Collision -> Primitive 항목이 있는데
Primitive는 Collision을 구성하는 기본 요소이다.
https://dev.epicgames.com/documentation/en-us/unreal-engine/static-mesh-editor-ui-in-unreal-engine
Static Mesh Editor UI in Unreal Engine
A description of the features and functions of the Unreal Editor used to preview the look, collision, and UVs, and set and manipulate the properties, of...
dev.epicgames.com
GameMode : 게임 내의 규칙을 정한다.
어떤 블루프린트를 사용해서 플레이어를 만들어내는지를 설정 할 수 있다
https://dev.epicgames.com/documentation/en-us/unreal-engine/setting-up-a-game-mode-in-unreal-engine
Setting Up a Game Mode in Unreal Engine
A tutorial for setting up a Game Mode in Unreal Engine.
dev.epicgames.com
강의를 따라하다 내 캐릭터가 움직이질 않았는데 찾아보니 나와 같은 사람이 있었다.
https://community.gamedev.tv/t/bp-player-is-not-moving/241592
BP_Player is not moving
The one made with GameMode2 was newly made because the previous GameMode was in error. I set up BP_Player as described in this lecture, but when I start the game, the player won’t move. Why? Unreal Engine 5 C++ Developer: Character Blueprint Lecture from
community.gamedev.tv
캐릭터를 움직일때 Enhanced Input을 사용하기 때문에 나의 Player Controller를 바꿔줄 필요가 있었다.
Blueprint -> Viewport -> Details -> Classes -> Player Controller Class를 수정해 주었다.
Inheritance vs Composition
Inheritance (상속) : A child class automatically has all the functionality of the parent. The child "is a" parent.
자식은 부모의 모든 걸 가지고 있기에 자식은 부모라고 할 수 있다.
Composition (구성) : Class A has an instance of Class B, it can choose to use it's functionality but doesn't have to.
Class A "has a" Class B.
클래스 A는 클래스 B의 인스턴스를 가지고 있고 클래스 B의 기능을 사용할 수 있지만 클래스 B가 클래스 A에 소속된 것이 아니다.
상속은 부모가 바뀌면 자식도 바뀌는 진한 관계이고 구성은 다른 클래스를 나의 클래스의 한 부분으로 사용하기 때문에 다른 클래스의 변경에 영향을 받지 않는다.
이러한 관계를 Loosely coupled, 느슨한 관계라 한다.
C++ Actor Component
기존 액터에 컴포넌트를 추가 할 수 있다
+Add -> new C++ Component 를 클릭하면
어떤 부모클래스를 기반으로 만들 것인지 정할 수 있다.
Actor Component (Class UActorComponent) : 추상적인 동작에 사용되며 Transform이 없다. 곧 월드에서 물리적 위치나 회전이 없다고 함.
Scene Component (Class USceneComponent, Child of UActorComponent) : 액터 컴포넌트를 상속받으며 지오메트리 표현을 필요하지 않은 위치 기반 동작을 지원한다.
https://dev.epicgames.com/documentation/en-us/unreal-engine/components-in-unreal-engine
Components in Unreal Engine
An overview of Components in Unreal Engine
dev.epicgames.com
생성을 하면 C++이 만들어지는데 Tick함수에 로그를 출력해보니 아주 잘 나온다.
'Unreal Engine > Udemy:UE5 C++ 학습하고 게임 만들기' 카테고리의 다른 글
Unreal Day - 24 - FMath::VInterpConstantTo (2) | 2024.04.21 |
---|---|
Unreal Day - 23 - Pointer & Dereferencing & Arrow Operator (2) | 2024.04.20 |
Unreal Day - 21 - Light Types (0) | 2024.04.18 |
Unreal Day - 20 - Section Intro - Crypt Raider (0) | 2024.04.17 |
Unreal Day - 19 - FString & const (0) | 2024.04.08 |