UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GeometryQueries.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Chaos/Box.h"
5#include "Chaos/Capsule.h"
7#include "Chaos/Convex.h"
8#include "Chaos/GJK.h"
9#include "Chaos/HeightField.h"
13#include "Chaos/Levelset.h"
14#include "Chaos/Plane.h"
15#include "Chaos/Sphere.h"
16#include "Chaos/Transform.h"
18
19#include "ChaosArchive.h"
20#include <algorithm>
21#include <utility>
22
23namespace Chaos
24{
25
32
33 template <typename QueryGeometry>
34 bool OverlapQuery(const FImplicitObject& A, const FRigidTransform3& ATM, const QueryGeometry& B, const FRigidTransform3& BTM, const FReal Thickness = 0, FMTDInfo* OutMTD=nullptr)
35 {
36 const EImplicitObjectType AType = A.GetType();
37 constexpr EImplicitObjectType BType = QueryGeometry::StaticType();
38
40 {
42 const FRigidTransform3 NewATM = TransformedA.GetTransform() * ATM;
43 return OverlapQuery(*TransformedA.GetTransformedObject(), NewATM, B, BTM, Thickness, OutMTD);
44 }
45
46 const FRigidTransform3 BToATM = BTM.GetRelativeTransform(ATM);
47
48 // This specialization for sphere is bugged since the sphere radius is not inverse scaled,
49 // nor can it be properly if testing against non-uniform scaled convexes
50 //if(BType == ImplicitObjectType::Sphere)
51 //{
52 // const FImplicitObject& BBase = static_cast<const FImplicitObject&>(B);
53 // const FSphere& BSphere = static_cast<const FSphere&>(BBase);
54 // const FVec3 PtInA = BToATM.TransformPositionNoScale(BSphere.GetCenter());
55 // return A.Overlap(PtInA, Thickness + BSphere.GetRadiusf());
56 //}
58 //else
59 if (A.IsConvex())
60 {
61 const FVec3 Offset = ATM.GetLocation() - BTM.GetLocation();
62 if (OutMTD)
63 {
64 return Utilities::CastHelper(A, BToATM, [&](const auto& AConcrete, const auto& BToAFullTM)
65 {
69 {
70 OutMTD->Normal = ATM.TransformVectorNoScale(LocalNormal);
71 OutMTD->Position = ATM.TransformPosition(LocalA);
72 return true;
73 }
74
75 return false;
76 });
77 }
78 else
79 {
80 return Utilities::CastHelper(A, BToATM, [&](const auto& AConcrete, const auto& BToAFullTM) { return GJKIntersection<FReal>(AConcrete, B, BToAFullTM, Thickness, Offset.SizeSquared() < 1e-4 ? FVec3(1, 0, 0) : Offset); });
81 }
82 }
83 else
84 {
85 bool bOverlap = false;
86 switch (AType)
87 {
89 {
90 const FHeightField& AHeightField = static_cast<const FHeightField&>(A);
92 break;
93 }
95 {
98 break;
99 }
101 {
102 const FLevelSet& ALevelSet = static_cast<const FLevelSet&>(A);
104 break;
105 }
108 {
109 const FImplicitObjectUnion& AUnion = static_cast<const FImplicitObjectUnion&>(A);
110 bool bHit = false;
112 [&bHit, &ATM, &B, &BTM, Thickness, &OutMTD](const FImplicitObject& SubObject, const FRigidTransform3& SubTransform)
113 {
115 if (OverlapQuery(SubObject, NewATM, B, BTM, Thickness, OutMTD))
116 {
117 bHit = true;
118 return true;
119 }
120
121 return false;
122 }
123 );
124
125 return bHit;
126 }
127 default:
128 {
129 if(IsScaled(AType))
130 {
132 bOverlap = AScaled.LowLevelOverlapGeom(B, BToATM, Thickness, OutMTD);
133 }
134 else if(IsInstanced(AType))
135 {
137 bOverlap = AInstanced.LowLevelOverlapGeom(B, BToATM, Thickness, OutMTD);
138 }
139 else
140 {
141 check(false); //unsupported query type
142 }
143 }
144 }
145
146 if (OutMTD && bOverlap)
147 {
148 OutMTD->Normal = ATM.TransformVectorNoScale(OutMTD->Normal);
149 OutMTD->Position = ATM.TransformPosition(OutMTD->Position);
150 }
151 return bOverlap;
152 }
153 }
154
155 UE_INTERNAL CHAOS_API void TransformSweepResultsToWorld(const bool bResult, const FReal Time, const bool bComputeMTD, const FImplicitObject& TestGeom, const FRigidTransform3& TestGeomTM, const FVec3& LocalDir, const FVec3& LocalPosition, const FVec3& LocalNormal, const int32 FaceIndex, FVec3& OutWorldPosition, FVec3& OutWorldNormal, FVec3& OutWorldFaceNormal);
156 UE_INTERNAL CHAOS_API bool SweepSphereVsSphere(const FSphere& SweptSphere, const FRigidTransform3& SweptSphereTM, const FSphere& TestSphere, const FRigidTransform3& TestSphereTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
157 UE_INTERNAL CHAOS_API bool SweepSphereVsBox(const FSphere& SweptSphere, const FRigidTransform3& SweptSphereTM, const TBox<FReal, 3>& TestBox, const FRigidTransform3& TestBoxTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
158 UE_INTERNAL CHAOS_API bool SweepSphereVsCapsule(const FSphere& SweptSphere, const FRigidTransform3& SweptSphereTM, const FCapsule& TestCapsule, const FRigidTransform3& TestCapsuleTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
159 UE_INTERNAL CHAOS_API bool SweepSphereVsConvex(const FSphere& SweptSphere, const FRigidTransform3& SweptSphereTM, const FImplicitObject& TestObject, const FRigidTransform3& TestObjectTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
160 UE_INTERNAL CHAOS_API bool SweepBoxVsSphere(const TBox<FReal, 3>& SweptBox, const FRigidTransform3& SweptBoxTM, const FSphere& TestSphere, const FRigidTransform3& TestSphereTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
161 UE_INTERNAL CHAOS_API bool SweepBoxVsCapsule(const TBox<FReal, 3>& SweptBox, const FRigidTransform3& SweptBoxTM, const FCapsule& TestCapsule, const FRigidTransform3& TestCapsuleTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
162 UE_INTERNAL CHAOS_API bool SweepCapsuleVsSphere(const FCapsule& SweptCapsule, const FRigidTransform3& SweptCapsuleTM, const FSphere& TestSphere, const FRigidTransform3& TestSphereTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
163 UE_INTERNAL CHAOS_API bool SweepCapsuleVsBox(const FCapsule& SweptCapsule, const FRigidTransform3& SweptCapsuleTM, const TBox<FReal, 3>& TestBox, const FRigidTransform3& TestBoxTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
164 UE_INTERNAL CHAOS_API bool SweepCapsuleVsCapsule(const FCapsule& SweptCapsule, const FRigidTransform3& SweptCapsuleTM, const FCapsule& TestCapsule, const FRigidTransform3& TestCapsuleTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
165 UE_INTERNAL CHAOS_API bool SweepCapsuleVsConvex(const FCapsule& SweptCapsule, const FRigidTransform3& SweptCapsuleTM, const FImplicitObject& TestObject, const FRigidTransform3& TestObjectTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal);
166
167 template <EImplicitObjectType SweptType>
168 UE_INTERNAL bool TryRunSpecializedSweep(const FImplicitObject& SweptShape, const FRigidTransform3& SweptShapeTM, const FImplicitObject& TestGeom, const FRigidTransform3& TestGeomTM, const FVec3& SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, bool& bOutResult, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal)
169 {
170 const EImplicitObjectType TestType = TestGeom.GetType();
172 {
174 {
176 const FSphere& TestSphere = TestGeom.GetObjectChecked<FSphere>();
177 bOutResult = SweepSphereVsSphere(SweptSphere, SweptShapeTM, TestSphere, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
178 return true;
179 }
181 {
184 bOutResult = SweepSphereVsBox(SweptSphere, SweptShapeTM, TestBox, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
185 return true;
186 }
188 {
191 bOutResult = SweepSphereVsCapsule(SweptSphere, SweptShapeTM, TestCapsule, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
192 return true;
193 }
194 else if (TestGeom.IsConvex())
195 {
197 bOutResult = SweepSphereVsConvex(SweptSphere, SweptShapeTM, TestGeom, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
198 return true;
199 }
200 }
202 {
204 {
206 const FSphere& TestSphere = TestGeom.GetObjectChecked<FSphere>();
207 bOutResult = SweepBoxVsSphere(SweptBox, SweptShapeTM, TestSphere, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
208 return true;
209 }
211 {
214 bOutResult = SweepBoxVsCapsule(SweptBox, SweptShapeTM, TestCapsule, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
215 return true;
216 }
217 }
219 {
221 {
223 const FSphere& TestSphere = TestGeom.GetObjectChecked<FSphere>();
224 bOutResult = SweepCapsuleVsSphere(SweptCapsule, SweptShapeTM, TestSphere, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
225 return true;
226 }
228 {
231 bOutResult = SweepCapsuleVsBox(SweptCapsule, SweptShapeTM, TestBox, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
232 return true;
233 }
235 {
238 bOutResult = SweepCapsuleVsCapsule(SweptCapsule, SweptShapeTM, TestCapsule, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
239 return true;
240 }
241 else if (TestGeom.IsConvex())
242 {
244 bOutResult = SweepCapsuleVsConvex(SweptCapsule, SweptShapeTM, TestGeom, TestGeomTM, SweepDir, Length, Thickness, bComputeMTD, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal);
245 return true;
246 }
247 }
248 return false;
249 }
250
251 template <typename SweptGeometry>
252 bool SweepQuery(const FImplicitObject& A, const FRigidTransform3& ATM, const SweptGeometry& B, const FRigidTransform3& BTM, const FVec3& Dir, const FReal Length, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal, const FReal Thickness, const bool bComputeMTD)
253 {
254 const EImplicitObjectType AType = A.GetType();
255 constexpr EImplicitObjectType BType = SweptGeometry::StaticType();
256
257 bool bResult = false;
258
260 {
262 const FRigidTransform3 NewATM = TransformedA.GetTransform() * ATM;
263 return SweepQuery(*TransformedA.GetTransformedObject(), NewATM, B, BTM, Dir, Length, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal, Thickness, bComputeMTD);
264 }
265
266 OutFaceIndex = INDEX_NONE;
268 if (TryRunSpecializedSweep<BType>(B, BTM, A, ATM, Dir, Length, Thickness, bComputeMTD, bResult, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal))
269 {
270 return bResult;
271 }
273
274 FVec3 LocalPosition(-TNumericLimits<FReal>::Max()); // Make it obvious when things go wrong
276
277 const FRigidTransform3 BToATM = BTM.GetRelativeTransformNoScale(ATM);
278 ensure(FMath::IsNearlyEqual(Dir.SizeSquared(), (FReal)1, (FReal)UE_KINDA_SMALL_NUMBER)); // Added to help determine cause of this ensure firing in GJKRaycast2.
279 const FVec3 LocalDir = ATM.InverseTransformVectorNoScale(Dir);
280
281 // We can optimize some sweeps as a raycast. Sweeps can have zero length and most raycast functions don't handle this.
282 // Do not allow unions to do this optimization. A union could contain a non-uniform scaled object which would break the optimization.
283 // Each internal object in the union will do the optimization if possible.
286 {
288 const FVec3& Scale = Scaled.GetScale();
290 }
291
292 if (bSweepAsRaycast)
293 {
294 const FImplicitObject& BBase = B;
296 const FVec3 Start = BToATM.TransformPositionNoScale(FVec3(BSphere.GetCenterf()));
297 bResult = A.Raycast(Start, LocalDir, Length, Thickness + BSphere.GetRadiusf(), OutTime, LocalPosition, LocalNormal, OutFaceIndex);
298 }
299 //todo: handle case where A is a sphere
300 else if (A.IsConvex())
301 {
302 auto IsValidConvex = [](const FImplicitObject& InObject) -> bool
303 {
304 //todo: move this out of here
305 if (const auto Convex = TImplicitObjectScaled<FConvex>::AsScaled(InObject))
306 {
307 return Convex->GetUnscaledObject()->NumVertices() > 0;
308 }
309
310 return true;
311 };
312
313 // Validate that the convexes we are about to test are actually valid geometries
314 if(!ensureMsgf(IsValidConvex(A), TEXT("GJKRaycast - Convex A has no particles")) ||
315 !ensureMsgf(IsValidConvex(B), TEXT("GJKRaycast - Convex B has no particles")))
316 {
317 return false;
318 }
319
320 const FVec3 Offset = ATM.GetLocation() - BTM.GetLocation();
322 [&](const auto& ADowncast, const auto& BToAFullTM)
323 {
324 return GJKRaycast2(ADowncast, B, BToAFullTM, LocalDir, Length, OutTime, LocalPosition, LocalNormal, Thickness, bComputeMTD, Offset, Thickness);
325 });
326
328 {
329 //todo: find face index
330 }
332 {
333 ensure(false);
334 //todo: find face index if convex hull
335 }
336 }
337 else
338 {
339 switch (AType)
340 {
342 {
343 const FHeightField& AHeightField = static_cast<const FHeightField&>(A);
344 bResult = AHeightField.SweepGeom(B, BToATM, LocalDir, Length, OutTime, LocalPosition, LocalNormal, OutFaceIndex, OutFaceNormal, Thickness, bComputeMTD);
345 break;
346 }
348 {
350 bResult = ATriangleMesh.SweepGeom(B, BToATM, LocalDir, Length, OutTime, LocalPosition, LocalNormal, OutFaceIndex, OutFaceNormal, Thickness, bComputeMTD);
351 break;
352 }
354 {
355 const FLevelSet& ALevelSet = static_cast<const FLevelSet&>(A);
356 bResult = ALevelSet.SweepGeom(B, BToATM, LocalDir, Length, OutTime, LocalPosition, LocalNormal, OutFaceIndex, Thickness, bComputeMTD);
357 break;
358 }
361 {
362 const FImplicitObjectUnion& AUnion = static_cast<const FImplicitObjectUnion&>(A);
363
364 bool bHit = false;
365 OutTime = TNumericLimits<FReal>::Max();
366 AUnion.ForEachObject(
367 [&bHit, &ATM, &B, &BTM, &Dir, Length, &OutTime, &OutPosition, &OutNormal, &OutFaceIndex, &OutFaceNormal, Thickness, bComputeMTD](const FImplicitObject& SubObject, const FRigidTransform3& SubTransform)
368 {
370
371 FReal ObjectTime = 0.0;
372 FVec3 ObjectPosition;
376
377 if (SweepQuery(SubObject, NewATM, B, BTM, Dir, Length, ObjectTime, ObjectPosition, ObjectNormal, ObjectFaceIndex, ObjectFaceNormal, Thickness, bComputeMTD))
378 {
379 bHit = true;
380 if (ObjectTime < OutTime)
381 {
382 OutTime = ObjectTime;
383 OutPosition = ObjectPosition;
384 OutNormal = ObjectNormal;
385 OutFaceIndex = ObjectFaceIndex;
386 OutFaceNormal = ObjectFaceNormal;
387 }
388 }
389
390 return false;
391 }
392 );
393
394 return bHit;
395 }
396 default:
397 if (IsScaled(AType))
398 {
400 bResult = AScaled.LowLevelSweepGeom(B, BToATM, LocalDir, Length, OutTime, LocalPosition, LocalNormal, OutFaceIndex, OutFaceNormal, Thickness, bComputeMTD);
401 break;
402 }
403 else if(IsInstanced(AType))
404 {
406 bResult = Instanced.LowLevelSweepGeom(B, BToATM, LocalDir, Length, OutTime, LocalPosition, LocalNormal, OutFaceIndex, OutFaceNormal, Thickness, bComputeMTD);
407 break;
408 }
409 else
410 {
411 ensureMsgf(false, TEXT("Unsupported query type: %u"), (uint8)AType);
412 }
413 }
414 }
415
416 //put back into world space
418 TransformSweepResultsToWorld(bResult, OutTime, bComputeMTD, A, ATM, LocalDir, LocalPosition, LocalNormal, OutFaceIndex, OutPosition, OutNormal, OutFaceNormal);
420
421 return bResult;
422 }
423
424
425 // @todo(chaos): This does not handle Unions
426 inline bool SweepQuery(const FImplicitObject& A, const FRigidTransform3& ATM, const FImplicitObject& B, const FRigidTransform3& BTM, const FVec3& Dir, const FReal Length, FReal& OutTime, FVec3& OutPosition, FVec3& OutNormal, int32& OutFaceIndex, FVec3& OutFaceNormal, const FReal Thickness, const bool bComputeMTD)
427 {
429 [&A, &ATM, &Dir, &Length, &OutTime, &OutPosition, &OutNormal, &OutFaceIndex, &OutFaceNormal, &Thickness, &bComputeMTD]
430 (const auto& BInner, const FTransform& BInnerTM) -> bool
431 {
432 return SweepQuery(A, ATM, BInner, BInnerTM, Dir, Length, OutTime, OutPosition, OutNormal, OutFaceIndex, OutFaceNormal, Thickness, bComputeMTD);
433 });
434 }
435
436}
#define check(expr)
Definition AssertionMacros.h:314
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define ensure( InExpression)
Definition AssertionMacros.h:464
#define PRAGMA_DISABLE_INTERNAL_WARNINGS
Definition CoreMiscDefines.h:346
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define PRAGMA_ENABLE_INTERNAL_WARNINGS
Definition CoreMiscDefines.h:347
#define UE_INTERNAL
Definition CoreMiscDefines.h:345
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Capsule.h:23
Definition HeightField.h:32
CHAOS_API bool OverlapGeom(const FSphere &QueryGeom, const FRigidTransform3 &QueryTM, const FReal Thickness, FMTDInfo *OutMTD=nullptr) const
Definition HeightField.cpp:2112
CHAOS_API bool SweepGeom(const FSphere &QueryGeom, const FRigidTransform3 &StartTM, const FVec3 &Dir, const FReal Length, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal, const FReal Thickness=0, bool bComputeMTD=false) const
Definition HeightField.cpp:2180
Definition ImplicitObjectUnion.h:27
CHAOS_API void ForEachObject(TFunctionRef< bool(const FImplicitObject &, const FRigidTransform3 &)> Lambda) const
Definition ImplicitObjectUnion.cpp:397
Definition ImplicitObject.h:111
const T_DERIVED & GetObjectChecked() const
Definition ImplicitObject.h:185
Definition Levelset.h:30
CHAOS_API bool SweepGeom(const FSphere &QueryGeom, const FRigidTransform3 &StartTM, const FVec3 &Dir, const FReal Length, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, const FReal Thickness=0, const bool bComputeMTD=false) const
Definition Levelset.cpp:1663
CHAOS_API bool OverlapGeom(const FSphere &QueryGeom, const FRigidTransform3 &QueryTM, const FReal Thickness, FMTDInfo *OutMTD=nullptr) const
Definition Levelset.cpp:1788
Definition TriangleMeshImplicitObject.h:490
CHAOS_API bool OverlapGeom(const FSphere &QueryGeom, const FRigidTransform3 &QueryTM, const FReal Thickness, FMTDInfo *OutMTD=nullptr) const
Definition TriangleMeshImplicitObject.cpp:1188
CHAOS_API bool SweepGeom(const FSphere &QueryGeom, const FRigidTransform3 &StartTM, const FVec3 &Dir, const FReal Length, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal, const FReal Thickness=0, const bool bComputeMTD=false, FVec3 TriMeshScale=FVec3(1.0f)) const
Definition Box.h:23
static const TImplicitObjectInstanced< TConcrete > & AsInstancedChecked(const FImplicitObject &Obj)
Definition ImplicitObjectScaled.h:217
Definition ImplicitObjectScaled.h:447
static const TImplicitObjectScaled< TConcrete > & AsScaledChecked(const FImplicitObject &Obj)
Definition ImplicitObjectScaled.h:522
Definition ImplicitObjectTransformed.h:37
@ TriangleMesh
Definition ImplicitObjectType.h:24
@ Union
Definition ImplicitObjectType.h:18
@ LevelSet
Definition ImplicitObjectType.h:19
@ Convex
Definition ImplicitObjectType.h:21
@ HeightField
Definition ImplicitObjectType.h:25
@ Box
Definition ImplicitObjectType.h:14
@ Capsule
Definition ImplicitObjectType.h:16
@ Sphere
Definition ImplicitObjectType.h:13
@ DEPRECATED_Scaled
Definition ImplicitObjectType.h:26
@ Transformed
Definition ImplicitObjectType.h:17
@ UnionClustered
Definition ImplicitObjectType.h:28
FORCEINLINE_DEBUGGABLE decltype(auto) CastHelper(const FImplicitObject &Geom, const Lambda &Func)
Definition CastingUtilities.h:21
FORCEINLINE_DEBUGGABLE decltype(auto) CastHelperNoUnwrap(const FImplicitObject &Geom, const FRigidTransform3 &TM, const Lambda &Func)
Definition CastingUtilities.h:129
Definition SkeletalMeshComponent.h:307
bool SweepQuery(const FImplicitObject &A, const FRigidTransform3 &ATM, const SweptGeometry &B, const FRigidTransform3 &BTM, const FVec3 &Dir, const FReal Length, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal, const FReal Thickness, const bool bComputeMTD)
Definition GeometryQueries.h:252
TRigidTransform< FReal, 3 > FRigidTransform3
Definition Core.h:22
uint8 EImplicitObjectType
Definition ImplicitObjectType.h:41
bool SweepBoxVsSphere(const TBox< FReal, 3 > &SweptBox, const FRigidTransform3 &SweptBoxTM, const FSphere &TestSphere, const FRigidTransform3 &TestSphereTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:125
UE_INTERNAL bool TryRunSpecializedSweep(const FImplicitObject &SweptShape, const FRigidTransform3 &SweptShapeTM, const FImplicitObject &TestGeom, const FRigidTransform3 &TestGeomTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, bool &bOutResult, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.h:168
FORCEINLINE bool IsInstanced(EImplicitObjectType Type)
Definition ImplicitObjectType.h:43
bool SweepSphereVsConvex(const FSphere &SweptSphere, const FRigidTransform3 &SweptSphereTM, const FImplicitObject &TestObject, const FRigidTransform3 &TestObjectTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:113
FRealDouble FReal
Definition Real.h:22
bool GJKRaycast2(const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &StartTM, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T GivenThicknessA=0, bool bComputeMTD=false, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T GivenThicknessB=0)
Definition GJK.h:1953
bool SweepSphereVsCapsule(const FSphere &SweptSphere, const FRigidTransform3 &SweptSphereTM, const FCapsule &TestCapsule, const FRigidTransform3 &TestCapsuleTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:93
FORCEINLINE bool IsScaled(EImplicitObjectType Type)
Definition ImplicitObjectType.h:48
bool SweepBoxVsCapsule(const TBox< FReal, 3 > &SweptBox, const FRigidTransform3 &SweptBoxTM, const FCapsule &TestCapsule, const FRigidTransform3 &TestCapsuleTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:133
bool SweepCapsuleVsCapsule(const FCapsule &SweptCapsule, const FRigidTransform3 &SweptCapsuleTM, const FCapsule &TestCapsule, const FRigidTransform3 &TestCapsuleTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:169
TVector< FReal, 3 > FVec3
Definition Core.h:17
void TransformSweepResultsToWorld(const bool bResult, const FReal Time, const bool bComputeMTD, const FImplicitObject &TestGeom, const FVec3 &TestGeomLocation, const FVec3 &LocalDir, const FVec3 &LocalPosition, const FVec3 &LocalNormal, const int32 FaceIndex, FVec3 &OutWorldPosition, FVec3 &OutWorldNormal, FVec3 &OutWorldFaceNormal)
Definition GeometryQueries.cpp:15
bool SweepCapsuleVsSphere(const FCapsule &SweptCapsule, const FRigidTransform3 &SweptCapsuleTM, const FSphere &TestSphere, const FRigidTransform3 &TestSphereTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:141
bool OverlapQuery(const FImplicitObject &A, const FRigidTransform3 &ATM, const QueryGeometry &B, const FRigidTransform3 &BTM, const FReal Thickness=0, FMTDInfo *OutMTD=nullptr)
Definition GeometryQueries.h:34
bool SweepSphereVsBox(const FSphere &SweptSphere, const FRigidTransform3 &SweptSphereTM, const TBox< FReal, 3 > &TestBox, const FRigidTransform3 &TestBoxTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:87
bool SweepCapsuleVsBox(const FCapsule &SweptCapsule, const FRigidTransform3 &SweptCapsuleTM, const TBox< FReal, 3 > &TestBox, const FRigidTransform3 &TestBoxTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:163
bool SweepCapsuleVsConvex(const FCapsule &SweptCapsule, const FRigidTransform3 &SweptCapsuleTM, const FImplicitObject &TestObject, const FRigidTransform3 &TestObjectTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:175
bool SweepSphereVsSphere(const FSphere &SweptSphere, const FRigidTransform3 &SweptSphereTM, const FSphere &TestSphere, const FRigidTransform3 &TestSphereTM, const FVec3 &SweepDir, const FReal Length, const FReal Thickness, const bool bComputeMTD, FReal &OutTime, FVec3 &OutPosition, FVec3 &OutNormal, int32 &OutFaceIndex, FVec3 &OutFaceNormal)
Definition GeometryQueries.cpp:70
Definition GeometryQueries.h:27
FVec3 Position
Definition GeometryQueries.h:29
FReal Penetration
Definition GeometryQueries.h:30
FVec3 Normal
Definition GeometryQueries.h:28
static UE_FORCEINLINE_HINT bool IsNearlyEqual(float A, float B, float ErrorTolerance=UE_SMALL_NUMBER)
Definition UnrealMathUtility.h:388
Definition NumericLimits.h:41