ShovelingLife
A Game Programmer
ShovelingLife
전체 방문자
오늘
어제
  • 분류 전체보기 (1067)
    • 그래픽스 (57)
      • 공통 (19)
      • 수학 물리 (22)
      • OpenGL & Vulkan (1)
      • DirectX (14)
    • 게임엔진 (180)
      • Unreal (69)
      • Unity (100)
      • Cocos2D-X (3)
      • 개인 플젝 (8)
    • 코딩테스트 (221)
      • 공통 (7)
      • 프로그래머스 (22)
      • 백준 (162)
      • LeetCode (19)
      • HackerRank (2)
      • 코딩테스트 알고리즘 (8)
    • CS (235)
      • 공통 (21)
      • 네트워크 (44)
      • OS & 하드웨어 (55)
      • 자료구조 & 알고리즘 (98)
      • 디자인패턴 (6)
      • UML (4)
      • 데이터베이스 (7)
    • 프로그래밍 언어 (346)
      • C++ (167)
      • C# (88)
      • Java (9)
      • Python (33)
      • SQL (30)
      • JavaScript (8)
      • React (7)
    • 그 외 (9)
      • Math (5)
      • 일상 (5)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

  • Source Code 좌측 상단에 복사 버튼 추가 완료
  • 언리얼 엔진 C++ 빌드시간 단축 꿀팁
  • 게임 업계 코딩테스트 관련
  • 1인칭 시점으로 써내려가는 글들

인기 글

태그

  • 티스토리챌린지
  • 문자열
  • C++
  • 알고리즘
  • 클래스
  • 유니티
  • SQL
  • 백준
  • 파이썬
  • 오블완
  • C
  • 언리얼
  • c#
  • string
  • 함수
  • 프로그래머스
  • 포인터
  • 배열
  • 그래픽스
  • Unity

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
ShovelingLife

A Game Programmer

[Unreal] 디버깅용 드로워 이용 방법 (Draw Debug)
게임엔진/Unreal

[Unreal] 디버깅용 드로워 이용 방법 (Draw Debug)

2022. 11. 22. 14:53

Debug Draw

Unreal engine 개발 과정에서 화면상에 원하는 도형을 그려서, 디버깅을 수월하게 도와주는 함수들에 대한 예제이다. DrawDebugHelpers.h 헤더파일 내에 구현 되어있다.

Draw Debug

#include "DrawDebugHelpers.h"

...

void Examples::DebugDrawExample(UWorld* World)
{
	FVector StartOffset = FVector(0, 0, 200);
	FVector LocationOne = FVector(0, 0, 600) + StartOffset;
	FVector LocationTwo = FVector(0, -600, 600) + StartOffset;
	FVector LocationThree = FVector(0, 600, 600) + StartOffset;
	FVector LocationFour = FVector(-300, 0, 600) + StartOffset;
	FVector LocationFive = FVector(-400, -600, 600) + StartOffset;

	DrawDebugPoint(World, LocationOne, 200, FColor(52, 220, 239), true);

	DrawDebugSphere(World, LocationTwo, 200, 26, FColor(181, 0, 0), true, -1, 0, 2);

	DrawDebugCircle(World, LocationFour, 200, 50, FColor(0, 0, 0), true, -1, 0, 10);

	DrawDebugBox(World, LocationFive, FVector(100, 100, 100), FColor::Purple, true, -1, 0, 10);

	DrawDebugLine(World, LocationTwo, LocationThree, FColor::Emerald, true, -1, 0, 10);

	DrawDebugDirectionalArrow(World, FVector(-300, 600, 600), FVector(-300, -600, 600), 120.f, FColor::Magenta, true, -1.f, 0, 5.f);

	DrawDebugCrosshairs(World, FVector(0, 0, 1000), FRotator(0, 0, 0), 500.f, FColor::White, true, -1.f, 0);
}

Draw Torque

void Examples::DebugDrawExample(UWorld* World)
{
	FVector StartOffset = FVector(-200, 0, 250);
	FVector LocationFour = FVector(-300, 0, 600) + StartOffset;
	
	const FVector CPos = StartOffset;
	const FVector FPos(CPos + FVector(-80, 50, 125));
	const FVector CF(FPos - CPos);
	const FVector Force = FVector(-50, -50, 50);
	const FVector Torque = FVector::CrossProduct(CF, Force);

	const FVector SideCF = CF.RotateAngleAxis(90, Torque.GetSafeNormal());
	
	DrawDebugSphere(World, CPos, 5, 26, FColor(181, 0, 0), true, -1, 0, 2);
	DrawDebugSphere(World, FPos, 5, 26, FColor(0, 181, 0), true, -1, 0, 2);

	DrawDebugDirectionalArrow(World, FPos, FPos + Force, 120.f, FColor::Magenta, true, -1.f, 0, 2.f);
	DrawDebugDirectionalArrow(World, CPos, CPos + Torque, 120.f, FColor::Black, true, -1.f, 0, 2.f);
	DrawDebugDirectionalArrow(World, CPos, CPos + CF, 120.f, FColor::Red, true, -1.f, 0, 2.f);
	DrawDebugDirectionalArrow(World, CPos, CPos + SideCF, 120.f, FColor::White, true, -1.f, 0, 2.f);

	DrawDebugCircle(World, CPos, CF.Size(), 50, FColor(0, 0, 0), true, -1, 0, 2, CF.GetSafeNormal(), SideCF.GetSafeNormal(), false);
}

출처 : [Unreal] 디버깅용 드로워 이용 방법 (Draw Debug) (tistory.com)

저작자표시 (새창열림)

'게임엔진 > Unreal' 카테고리의 다른 글

[Unreal] 클래스 블프 및 메쉬, 텍스처 등 로딩 Finder  (0) 2022.12.03
[Unreal] 멀티플레이 개념잡기 Replicated  (0) 2022.11.27
[Unreal] UI(위젯)에서 메인 캐릭터 가져오기  (0) 2022.11.19
[Unreal] 포인터 널 체크는 조심히 하도록 하자  (0) 2022.10.21
[Unreal] 리깅 및 리타겟터 (각기 다른 메시 애니메이션 연동 Mixamo)  (0) 2022.10.19
    '게임엔진/Unreal' 카테고리의 다른 글
    • [Unreal] 클래스 블프 및 메쉬, 텍스처 등 로딩 Finder
    • [Unreal] 멀티플레이 개념잡기 Replicated
    • [Unreal] UI(위젯)에서 메인 캐릭터 가져오기
    • [Unreal] 포인터 널 체크는 조심히 하도록 하자
    ShovelingLife
    ShovelingLife
    Main skill stack => Unity C# / Unreal C++ Studying Front / BackEnd, Java Python

    티스토리툴바