Yasiu Math 1
Collection of mathematic functions that help create game mechanics and procedural tools
Loading...
Searching...
No Matches
BPFunLib_Ballistic.h
1/*
2 * Copyright (c) 2026 Grzegorz Krug.
3 * All Rights Reserved.
4 */
5
6#pragma once
7
8
10#include "YasiuMathLib.h"
11
12
13#include "BPFunLib_Ballistic.generated.h"
14
15
23USTRUCT(BlueprintType, Category="YasiuMath|Ballistics")
25 GENERATED_BODY()
26
27
28 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
29 FVector Position;
30
32 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
33 FVector Velocity;
34
36 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
37 FVector Acceleration;
38
40 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
41 float MaxSpeed = 0;
42
47 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
49
50 YasiuMath::Ballistics::ProjectileDynamicState<double> ToDynamicObject() const;
51
52 FBallisticObject& FromDynamic( const YasiuMath::Ballistics::ProjectileDynamicState<double>& Ob );
53};
54
55
61USTRUCT(BlueprintType, Category="YasiuMath|Ballistics")
63 GENERATED_BODY()
64
65 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
66 FVector Position;
67
72 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
73 double InitialSpeed = 0;
74
76 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
77 double Acceleration = 0;
78
80 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
81 double MaxSpeed = 0;
82
84 UPROPERTY(BlueprintReadWrite, Category="YasiuMath")
85 double AirResistance = 0;
86
87 YasiuMath::Ballistics::InterceptorParams<double> ToInterceptor() const;
88
89 void FromInterceptor( const YasiuMath::Ballistics::InterceptorParams<double>& Ob );
90};
91
92
96UCLASS(BlueprintType)
98 GENERATED_BODY()
99
100
101public:
108 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="YasiuMath|Ballistics")
109 static FBallisticObject DiscreteStep( const FBallisticObject& Ob, const float DeltaStep );
110
124 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="YasiuMath|Ballistics")
125 static FBallisticObject AutoStep( const FBallisticObject& Ob, const float PredictTime, const float DeltaStep );
126
137 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="YasiuMath|Ballistics")
138 static bool Intercept_Linear(
139 const FVector& TargetPosition,
140 const FVector& TargetVelocity,
141 double InterceptSpeed,
142 FVector& HitLocation,
143 double& HitTime
144 );
145
157 UFUNCTION(BlueprintCallable, BlueprintPure=false, Category="YasiuMath|Ballistics")
158 static bool Intercept_Dynamic(
159 const FBallisticObject& Target,
160 const FBallisticInterceptor Interceptor,
161 double MaxQueryTime,
162 double StepTime,
163 double AccurateStepTime,
164 FVector& HitLocation,
165 double& HitTime
166 );
167};
Function library used for projectile prediction and missile interception calculations.
Definition BPFunLib_Ballistic.h:97
static bool Intercept_Dynamic(const FBallisticObject &Target, const FBallisticInterceptor Interceptor, double MaxQueryTime, double StepTime, double AccurateStepTime, FVector &HitLocation, double &HitTime)
Prediction function for objects with variable speed and resistance.
static FBallisticObject AutoStep(const FBallisticObject &Ob, const float PredictTime, const float DeltaStep)
Predict multiple steps in loop. Optimized for AirDrag=0, see details...
static bool Intercept_Linear(const FVector &TargetPosition, const FVector &TargetVelocity, double InterceptSpeed, FVector &HitLocation, double &HitTime)
Prediction function for linear objects. Works only for objects with constant speeds,...
static FBallisticObject DiscreteStep(const FBallisticObject &Ob, const float DeltaStep)
Single iterative step.
BP Function placeholder to group libraries in documentation.
Definition YasiuMathBPLibrary.h:29
Linear and dynamic objects simulation / prediction.
Definition YasiuMathLib.h:578
Categorized name spaces.
Definition Constants.h:10
Type for passing parameters, see details how use...
Definition BPFunLib_Ballistic.h:62
double Acceleration
Acceleration in any direction.
Definition BPFunLib_Ballistic.h:77
double AirResistance
Keep in <0, 1> range!
Definition BPFunLib_Ballistic.h:85
double InitialSpeed
Speed at which object starts moving, should move towards correct location!
Definition BPFunLib_Ballistic.h:73
double MaxSpeed
Max speed object can reach with acceleration, 0 or less is ignored.
Definition BPFunLib_Ballistic.h:81
Type for simulating movement, see details how use...
Definition BPFunLib_Ballistic.h:24
FVector Position
Current position.
Definition BPFunLib_Ballistic.h:29
float MaxSpeed
Maximal speed(length) of velocity vector.
Definition BPFunLib_Ballistic.h:41
float AirFrictionCoeff
Movement resistance opposite to current velocity vector. Must be in <0, 1> range. More in details....
Definition BPFunLib_Ballistic.h:48
FVector Acceleration
Acceleration or Deceleration or combined with Gravity Forces.
Definition BPFunLib_Ballistic.h:37
FVector Velocity
Movement velocity vector.
Definition BPFunLib_Ballistic.h:33