Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
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
8/**
9 * Structure for capsules.
10 *
11 * A capsule consists of two sphere connected by a cylinder.
12 */
13namespace UE
14{
15namespace Math
16{
17
18template<typename T>
19struct TCapsuleShape
20{
21 using FReal = T;
22
23 /** The capsule's center point. */
24 TVector<T> Center;
25
26 /** The capsule's radius. */
27 T Radius;
28
29 /** The capsule's orientation in space. */
30 TVector<T> Orientation;
31
32 /** The capsule's length. */
33 T Length;
34
35public:
36
37 /** Default constructor. */
38 TCapsuleShape() { }
39
40 /**
41 * Create and inintialize a new instance.
42 *
43 * @param InCenter The capsule's center point.
44 * @param InRadius The capsule's radius.
45 * @param InOrientation The capsule's orientation in space.
46 * @param InLength The capsule's length.
47 */
48 TCapsuleShape(TVector<T> InCenter, T InRadius, TVector<T> InOrientation, T InLength)
49 : Center(InCenter)
50 , Radius(InRadius)
51 , Orientation(InOrientation)
52 , Length(InLength)
53 { }
54
55 // Conversion to other type.
56 template<typename FArg, TEMPLATE_REQUIRES(!std::is_same_v<T, FArg>)>
57 explicit TCapsuleShape(const TCapsuleShape<FArg>& From) : TCapsuleShape<T>(TVector<T>(From.Center), (T)From.Radius, TVector<T>(From.Orientation), (T)From.Length) {}
58};
59
60} // namespace UE::Math
61} // namespace UE
62
63UE_DECLARE_LWC_TYPE(CapsuleShape, 3);
64
65template<> struct TIsUECoreVariant<FCapsuleShape3f> { enum { Value = true }; };
66template<> struct TIsUECoreVariant<FCapsuleShape3d> { enum { Value = true }; };
#define UE_DECLARE_LWC_TYPE(...)
#define TEMPLATE_REQUIRES(...)