KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
FMathHelper 구조체 참조

#include <FMathHelper.h>

+ FMathHelper에 대한 협력 다이어그램:

정적 Public 멤버 함수

static void DrawParabolaDebug (UWorld *World, const FVector &Start, const FVector &End, const float Height, const int32 NumSegments=20, const float LifeTime=2.0f, const FColor Color=FColor::Green)
 두 점(Start → End)을 잇는 곡선을 디버그 라인으로 그립니다.
 
static void DrawProjectileArcDebug (UWorld *World, const FVector &Start, const FVector &V0, float GravityZ=-980.f, int32 NumSegments=20, float StepTime=0.1f, float LifeTime=2.0f, FColor Color=FColor::Red)
 초기 속도 V0를 이용해 물리 기반 포물선 궤적을 디버그 라인으로 그립니다.
 
static FVector InterpArcSin (const FVector &Start, const FVector &End, float Height, float Alpha)
 선형 보간 경로에 사인 함수를 더해 아치 형태의 곡선을 생성합니다.
 
static FVector SolveV0ForProjectile (const FVector &Start, const FVector &End, float Time, float GravityZ=-980.f)
 주어진 시간 안에 목표 지점에 도달하기 위한 초기 속도를 계산합니다.
 

상세한 설명

FMathHelper.h 파일의 7 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ DrawParabolaDebug()

static void FMathHelper::DrawParabolaDebug ( UWorld *  World,
const FVector &  Start,
const FVector &  End,
const float  Height,
const int32  NumSegments = 20,
const float  LifeTime = 2.0f,
const FColor  Color = FColor::Green 
)
inlinestatic

두 점(Start → End)을 잇는 곡선을 디버그 라인으로 그립니다.

(보간 기반 아치)

원리:

  • 구간을 NumSegments로 나누어 일정 간격의 α 값을 계산
  • 각 α에서 CalcParabola(Start, End, Height, α)로 좌표를 얻음
  • 이전 점(PrevPos)과 현재 점(CurrPos)을 연결하는 선분을 DrawDebugLine으로 그림

특징:

  • 단순히 디버깅/시각화를 위한 함수 (실제 렌더링 아님)
  • CalcParabola() 구현체에 따라 사인 아치, 베지에 아치 등 원하는 형태 표시 가능

매개변수:

  • World : UWorld 포인터 (필수, 없으면 반환)
  • Start/End : 시작/끝 좌표
  • Height : 아치 높이
  • NumSegments: 곡선을 나눌 선분 개수 (값이 클수록 곡선이 부드러움)
  • LifeTime : 디버그 라인이 화면에 유지되는 시간 (초 단위)
  • Color : 라인 색상

FMathHelper.h 파일의 130 번째 라인에서 정의되었습니다.

138 {
139 if (!World) return;
140
141 FVector PrevPos = Start;
142 for (int32 i = 1; i <= NumSegments; ++i)
143 {
144 const float Alpha = (float)i / (float)NumSegments;
145 FVector CurrPos = InterpArcSin(Start, End, Height, Alpha);
146
147 DrawDebugLine(World, PrevPos, CurrPos, Color, false, LifeTime, 0, 1.5f);
148 PrevPos = CurrPos;
149 }
150 }
static FVector InterpArcSin(const FVector &Start, const FVector &End, float Height, float Alpha)
선형 보간 경로에 사인 함수를 더해 아치 형태의 곡선을 생성합니다.
Definition FMathHelper.h:52

다음을 참조함 : Color, InterpArcSin().

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DrawProjectileArcDebug()

static void FMathHelper::DrawProjectileArcDebug ( UWorld *  World,
const FVector &  Start,
const FVector &  V0,
float  GravityZ = -980.f,
int32  NumSegments = 20,
float  StepTime = 0.1f,
float  LifeTime = 2.0f,
FColor  Color = FColor::Red 
)
inlinestatic

초기 속도 V0를 이용해 물리 기반 포물선 궤적을 디버그 라인으로 그립니다.

운동 방정식: P(t) = Start + V0 * t + 0.5 * g * t^2

특징:

  • SolveV0ForProjectile()로 계산된 V0를 입력받아, 실제 물리 포물선을 시각화
  • 중력 가속도(GravityZ)를 직접 지정 가능
  • Segment 수와 StepTime을 통해 해상도 조절

매개변수:

  • World : UWorld 포인터 (필수, 없으면 반환)
  • Start : 시작 좌표
  • V0 : 초기 속도 (SolveV0ForProjectile로 얻을 수 있음)
  • GravityZ : 중력 값 (언리얼 기본: -980.f)
  • NumSegments: 선분 개수 (값이 클수록 매끄러움)
  • StepTime : 시뮬레이션 시간 단위 (초 단위, Segments와 Duration 균형 필요)
  • LifeTime : 디버그 라인 유지 시간 (초 단위)
  • Color : 라인 색상

FMathHelper.h 파일의 84 번째 라인에서 정의되었습니다.

93 {
94 if (!World) return;
95
96 const FVector g(0, 0, GravityZ);
97
98 FVector PrevPos = Start;
99 for (int32 i = 1; i <= NumSegments; ++i)
100 {
101 float t = StepTime * i;
102 FVector CurrPos = SolveV0ForProjectile(PrevPos, CurrPos, t, GravityZ);
103 // Start + V0 * t + 0.5f * g * t * t;
104
105 DrawDebugLine(World, PrevPos, CurrPos, Color, false, LifeTime, 0, 1.5f);
106 PrevPos = CurrPos;
107 }
108 }
static FVector SolveV0ForProjectile(const FVector &Start, const FVector &End, float Time, float GravityZ=-980.f)
주어진 시간 안에 목표 지점에 도달하기 위한 초기 속도를 계산합니다.
Definition FMathHelper.h:24

다음을 참조함 : Color, SolveV0ForProjectile().

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ InterpArcSin()

static FVector FMathHelper::InterpArcSin ( const FVector &  Start,
const FVector &  End,
float  Height,
float  Alpha 
)
inlinestatic

선형 보간 경로에 사인 함수를 더해 아치 형태의 곡선을 생성합니다.

(시각 효과 기반)

공식: Base(α) = (1-α) * Start + α * End Offset(α) = sin(π * α) * Height Result = Base + (0,0,Offset)

특징:

  • 실제 물리와 무관, 단순히 아치 형태를 연출
  • α=0과 α=1에서 0, α=0.5에서 최대 Height

용도:

  • 스킬 이펙트, UI 이동, 단순한 점프 연출 등

FMathHelper.h 파일의 52 번째 라인에서 정의되었습니다.

57 {
58 FVector Base = FMath::Lerp(Start, End, Alpha);
59 float OffsetZ = FMath::Sin(Alpha * PI) * Height; // (0→Height→0)
60 return Base + FVector(0, 0, OffsetZ);
61 }

다음에 의해서 참조됨 : DrawParabolaDebug(), FParabolaGeometricTrack::EvaluateAtTime().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ SolveV0ForProjectile()

static FVector FMathHelper::SolveV0ForProjectile ( const FVector &  Start,
const FVector &  End,
float  Time,
float  GravityZ = -980.f 
)
inlinestatic

주어진 시간 안에 목표 지점에 도달하기 위한 초기 속도를 계산합니다.

(운동 방정식 기반)

공식: P(t) = Start + V0 * t + 0.5 * g * t^2 → V0 = (End - Start - 0.5 * g * t^2) / t

특징:

  • 뉴턴 역학 기반의 실제 투사체/점프 궤적
  • 중력 값(GravityZ)을 반영

용도:

  • 점프 궤적, 포물선 투사체, 실제 물리 시뮬레이션

FMathHelper.h 파일의 24 번째 라인에서 정의되었습니다.

29 {
30 if (Time <= KINDA_SMALL_NUMBER)
31 return FVector::ZeroVector;
32
33 const FVector g(0, 0, GravityZ);
34 return (End - Start - 0.5f * g * Time * Time) / Time;
35 }

다음을 참조함 : Time.

다음에 의해서 참조됨 : DrawProjectileArcDebug(), FParabolaBallisticTrack::SolveV0ForArc().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

이 구조체에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: