본문 바로가기

프로그래밍/Unreal Engine418

UE4 두백터를 이용한 방향(Direction)과 회전 Angle 구하는 코드 123456789101112131415161718192021222324252627282930313233 FVector Dest = FVector(GoalPosition.X, GoalPosition.Y, 0.0f); FVector Start = FVector(GetTransform().GetLocation().X, GetTransform().GetLocation().Y, 0.0f); FVector dir = Dest - Start; GoalDirection = dir.SafeNormal(); //노말라이징한 두개의 백터를 dot한다. //여기서 축을 Z축으로 하기 위해 두백터의 Z값을 0.0f로 넣어 주었다. float dot = FVector::DotProduct(FVector::ForwardVector.. 2016. 4. 20.
현재 레벨에 있는 다른 Actor의 C++클래스 연결하기. 기본 적인 방법123456789101112131415161718192021222324252627//받아올 클래스 static AStageFloor* stagefloor = nullptr; //현재 래벨에 존재하는 모든 액터를 가져온다. TTransArray actors = GetWorld()->GetCurrentLevel()->Actors; for (int i = 0; i FindComponentByClass(); //만약 USceneComponent를 RootComponent 검색해서 있다면 연결하고. if (root) { //열결한 Root(USceneComponent)가 StageFloor를 Tag로 가지고 있다면 if (root->ComponentHasTag("StageFloor")) { //현재.. 2016. 4. 20.
언리얼 C++ 컨텐츠 브라우저에서 제거 하는법 1. 먼저 VS에서 .cpp와 .h 를 지운다.2. 탐색기 에서도 지운다.3. VS에서 솔루션 빌드를 한다. (ctrl + shift + b ) //여기까지 하면 아직 컨텐츠에는 남아 있다. 4. 마지막으로 언리얼을 껏다가 다시 키면 컨텐츠 브라우저 에서 지워져 있다. 2016. 4. 19.
BoxComponent안의 랜덤한 포지션 받아오는 방법 123456789FVector AStageFloor::GetRandomPosition(){ //#include "Kismet/KismetMathLibrary.h" 가 필요하다. //UBoxComponent* FloorCollision; FVector Origin = FloorCollision->Bounds.Origin; FVector Extent = FloorCollision->Bounds.BoxExtent; return UKismetMathLibrary::RandomPointInBoundingBox(Origin, Extent);}Colored by Color Scriptercs 2016. 4. 18.