[Unreal Engine] FVector API

Hongyeol Kim·2022년 1월 1일
0

언리얼 엔진

목록 보기
2/9
post-thumbnail

UDN 링크 : https://docs.unrealengine.com/4.27/en-US/API/Runtime/Core/Math/FVector/
참고 링크 : https://blog.2bbear.dev/entry/Unreal-%EA%B0%9C%EB%B0%9C%EA%B8%B0-5-FVector-API-%EC%A0%95%EB%A6%AC

FVector

언리얼 엔진 전용으로 사용하는 3D공간 상에서 X, Y, Z 컴포넌트를 가진 벡터 구조체

1. 주요 생성자(Constructor)

  • FVector() 초기화를 시키지 않는 생성자. 쓰레기 값이 들어갈 수 있음에 유의!
  • FVector(float Inf) 모든 컴포넌트(x,y,z)를 Inf값으로 초기화
  • FVector(float x, float y, float z) x, y, z로 xyz 컴포넌트 값을 초기화

2. 주요 함수(Functions)

  • bool AllComponentsEqual (float Tolerance) : 해당 벡터의 모든 컴포넌트(x,y,z)가 Tolerance 이상인지 판별하는 함수=범위를 넘었는지 판별용
  • FVector BoundToCube(float Radius) : 해당 벡터의 모든 컴포넌트를 Radius값 이하로 조절하는 함수=오브젝트의 최대 움직임 반경 설정
  • FVector ClampMaxSize(float MaxSize) : 해당 벡터의 모든 컴포넌트를 Maxsize 이하로 조절한다. 사용 방법은 BoundToCube와 동일.
  • FVector ClampSize(float Min ,float Max) : 해당벡터의 모든 컴포넌트를 Min이상 Max이하로 조절한다.
  • bool Coincident(const FVector & Nomal1, const FVector & Nomal2 , float ParallelCosineThreshold) : 두 벡터의 방향성이 거의 ParallelCosineThreshold(오차범위) 내외로 비슷한지 판별하는 함수
  • bool ConstainsNaN() : 해당 벡터에 x,y,z로 들어갈 수 없는 값이 들어가 있는지 확인하는 함수(무한대 숫자들이 걸러진다. 또는 들어가면 안되는게 들어 갔을때 걸러진다.)
  • float Dist(cibst FVector & V1, const FVector & V2) : 두 벡터 사이의 거리를 구하는 함수
  • bool Equals(const FVector & V , float Tolerance) : 해당 벡터가 V 벡터와 같은지 오차범위 Tolerance 안에서 반별하는 함수
  • bool Orthogonal(정규화 벡터 1 , 정규화 벡터 2, 오차범위) : 두 정규화 벡터라고 하지만 그냥 벡터를 넣어도 무방하다. 이 두 벡터가 직각인지 오차 범위 내에서 확인 해준다.
  • bool PointsAreNear(벡터 1 , 벡터 2 , 오차범위) : 두 벡터가 오차범위 내로 근접해 있는지 확인해주는 함수
  • FVector CrossProduct(const FVector& A, const FVector& B) : 두 벡터의 외적을 구하는 함수
  • float DotProduct(const FVector& A, const FVector& B) : 두 벡터의 내적을 구하는 함수

3. 주요 상수(Constants)

  • FVector::ForwardVector : (1, 0, 0)
  • FVector::BackwardVector : (-1, 0, 0)
  • FVector::UpVector : (0, 0, 1)
  • FVector::DownVector : (0, 0, -1)
  • FVector::RightVector : (0, 1, 0)
  • FVector::LeftVector : (0, -1, 0)
  • FVector::ZeroVector : (0, 0, 0)
  • FVector::OneVector : (1, 1, 1)
  • FVector::XAxisVector : (1, 0, 0)
  • FVector::YAxisVector : (0, 1, 0)
  • FVector::ZAxisVector : (0, 0, 1)
profile
Game Engine/Client Programmer

0개의 댓글