UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CapsuleShape.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Math/Vector.h"
7
13namespace UE
14{
15namespace Math
16{
17
18template<typename T>
20{
21 using FReal = T;
22
25
28
31
34
35public:
36
39
54
55 // Conversion to other type.
56 template<typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
58 : TCapsuleShape<T>(TVector<T>(From.Center), (T)From.Radius, TVector<T>(From.Orientation), (T)From.Length)
59 {
60 }
61
62 [[nodiscard]] bool IsInside(const TVector<T>& In, T Tolerance = UE_KINDA_SMALL_NUMBER) const
63 {
68 return (Projection - In).SizeSquared() <= FMath::Square(Radius + Tolerance);
69 }
70};
71
72} // namespace UE::Math
73} // namespace UE
74
76
77template<> struct TIsUECoreVariant<FCapsuleShape3f> { enum { Value = true }; };
78template<> struct TIsUECoreVariant<FCapsuleShape3d> { enum { Value = true }; };
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_DECLARE_LWC_TYPE(...)
Definition LargeWorldCoordinates.h:27
AUTORTFM_INFER constexpr auto Projection(Invocable0Type &&Invocable0, InvocableTypes &&... Invocables)
Definition Projection.h:108
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
Definition AdvancedWidgetsModule.cpp:13
static constexpr UE_FORCEINLINE_HINT T Square(const T A)
Definition UnrealMathUtility.h:578
static CORE_API UE::Math::TVector< T > ClosestPointOnSegment(const UE::Math::TVector< T > &Point, const UE::Math::TVector< T > &StartPoint, const UE::Math::TVector< T > &EndPoint)
Definition IsUECoreType.h:19
@ Value
Definition IsUECoreType.h:20
Definition CapsuleShape.h:20
TCapsuleShape()
Definition CapsuleShape.h:38
T Radius
Definition CapsuleShape.h:27
T Length
Definition CapsuleShape.h:33
bool IsInside(const TVector< T > &In, T Tolerance=UE_KINDA_SMALL_NUMBER) const
Definition CapsuleShape.h:62
TCapsuleShape(const TCapsuleShape< FArg > &From)
Definition CapsuleShape.h:57
TVector< T > Orientation
Definition CapsuleShape.h:30
T FReal
Definition CapsuleShape.h:21
TVector< T > Center
Definition CapsuleShape.h:24
TCapsuleShape(TVector< T > InCenter, T InRadius, TVector< T > InOrientation, T InLength)
Definition CapsuleShape.h:48
Definition Vector.h:51