언리얼4 C++ LineTrace

Intro

  • C++ Line Trace

플레이어 뷰포인트 가져오기

디버그 라인 그리기

헤더파일에 Reach변수 선언

private:
	float Reach = 100.f;

플레이어가 바라보는 방향과 Reach를 이용하여 LineTraceEnd 저장


FVector LineTraceEnd = PlayerViewPointLocation + PlayerViewPointRotation.Vector()*Reach;

DrawDebugLine 함수로 디버그 라인 생성

생성된 디버그 라인

1

라인 트레이스로 충돌 체크

성공적으로 출력되는 로그

2

참고문서

https://unrealcpp.com/line-trace-on-tick/

http://api.unrealengine.com/INT/API/Runtime/Engine/Engine/UWorld/LineTraceSingleByObjectType/

http://api.unrealengine.com/INT/API/Runtime/Engine/FCollisionQueryParams/

댓글남기기