1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | AStageFloor::AStageFloor() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; RootComp = CreateDefaultSubobject<USceneComponent>(TEXT("Root")); RootComp->SetWorldLocation(FVector(0.0f, 0.0f, 0.0f)); RootCompScale = FVector(10.0f, 10.0f, 1.0f); RootComp->SetWorldScale3D(RootCompScale); RootComp->ComponentTags.Add("StageFloor"); RootComponent = RootComp; FloorMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Floor Mesh")); FloorMesh->AttachTo(RootComponent); //경로를 넣어준다. static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeMeshAsset(TEXT("/Game/StarterContent/Shapes/Shape_Cube")); //경로상에 에셋이 존재해서 성공할경우 작업을 해준다. if (CubeMeshAsset.Succeeded()) { FloorMesh->SetStaticMesh(CubeMeshAsset.Object); FloorMesh->SetRelativeLocation(FVector(0.0f, 0.0f, -50.0f)); FloorMesh->SetRelativeScale3D(FVector(1.0f, 1.0f, 1.0f)); } static ConstructorHelpers::FObjectFinder<UMaterial> CubeMaterialAsset(TEXT("/Game/Floor/StageFloor_Mtl")); if (CubeMaterialAsset.Succeeded()) { FloorMesh->SetMaterial(0, CubeMaterialAsset.Object); } FloorCollision = CreateDefaultSubobject<UBoxComponent>(TEXT("Floor BoxCollision")); FloorCollision->AttachTo(RootComponent); FloorCollision->SetRelativeLocation(FVector(0.0f, 0.0f, 0.0f)); FloorCollision->SetRelativeScale3D(FVector(1.5f, 1.5f, 2.0f)); FloorCollision->ComponentTags.Add("StageFloorBoundBox"); } | cs |
'Unreal Engine4 or 5 > 코드' 카테고리의 다른 글
언리얼 엔진 C++ 에서의 모듈 추가 (0) | 2018.12.31 |
---|---|
UE4] Blueprint의 노출되는 함수. (0) | 2017.07.19 |
UE4 게임플레이 타이머 * 코루틴(?) (0) | 2016.04.26 |
언리얼 C++ 튜토리얼 003.CountDown Timer (0) | 2016.04.25 |
UE4 C++ 비주얼 스튜디오 에서 BreakPoint 사용하는법 (0) | 2016.04.25 |