181{
183
184 if (WorldContextObject == nullptr || TargetHeight < KINDA_SMALL_NUMBER)
185 {
186 return false;
187 }
188
191
192 if (FVector::DistSquared(PathStart, PathEnd) < KINDA_SMALL_NUMBER)
193 {
194 return false;
195 }
196
197 const int32 SafeSegmentCount = FMath::Max(
SegmentCount, 1);
199
201 {
202 return false;
203 }
204
205 float PreviousAlpha = 0.0f;
207
208 if (FMath::Abs(PreviousDelta) <= KINDA_SMALL_NUMBER)
209 {
210 OutResult = PreviousResult;
211 return true;
212 }
213
214 for (int32 SegmentIndex = 1; SegmentIndex <= SafeSegmentCount; ++SegmentIndex)
215 {
216 const float CurrentAlpha = static_cast<float>(SegmentIndex) / static_cast<float>(SafeSegmentCount);
218
220 {
221 return false;
222 }
223
225
226 if (FMath::Abs(CurrentDelta) <= KINDA_SMALL_NUMBER)
227 {
228 OutResult = CurrentResult;
229 return true;
230 }
231
232 bool bValue;
233
234 if (
BSForHeight(PathStart, PathEnd, TargetHeight, OutResult, PreviousAlpha, PreviousDelta, CurrentAlpha, CurrentDelta, bValue))
235 {
236 return bValue;
237 }
238
239 PreviousAlpha = CurrentAlpha;
240 PreviousDelta = CurrentDelta;
241 PreviousResult = CurrentResult;
242 }
243
244 return false;
245}
int32 SegmentCount
Definition ProjectilePathSelector.h:69
bool BSForHeight(const FVector &PathStart, const FVector &PathEnd, float TargetHeight, FProjectilePathResult &OutResult, float PreviousAlpha, float PreviousDelta, float CurrentAlpha, float CurrentDelta, bool &bValue) const
Definition ProjectilePathSelector.cpp:132