diff options
| author | Léo Lam <leo@leolam.fr> | 2022-12-17 22:15:30 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2022-12-18 01:24:44 +0100 |
| commit | 30368facc0c1f0700f3c49806a20b95333048163 (patch) | |
| tree | b1c667e058b70ab4e12174ecc1cda81ef8d2dee6 /lib | |
| parent | 7934e14ad675f27d6e7da2dff9b3175e1419dbc7 (diff) | |
ksys/phys: Finish RagdollRigidBody and add more RagdollController functions
Diffstat (limited to 'lib')
3 files changed, 23 insertions, 1 deletions
diff --git a/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.h b/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.h index c9bd6b97..cf11f5f5 100644 --- a/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.h +++ b/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.h @@ -147,6 +147,10 @@ public: template <int N> HK_FORCE_INLINE void setDot(hkVector4fParameter a, hkVector4fParameter b); + /// Get the length of this vector as if it had N components. + template <int N> + HK_FORCE_INLINE hkSimdFloat32 length() const; + /// Get the squared length (|v|^2) of this vector as if it had N components. template <int N> HK_FORCE_INLINE hkSimdFloat32 lengthSquared() const; diff --git a/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl b/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl index 41c5a1a1..8dba60dd 100644 --- a/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl +++ b/lib/hkStubs/Havok/Common/Base/Math/Vector/hkVector4f.inl @@ -482,6 +482,11 @@ inline void hkVector4f::setDot(hkVector4fParameter a, hkVector4fParameter b) { } template <int N> +inline hkSimdFloat32 hkVector4f::length() const { + return lengthSquared<N>().sqrt(); +} + +template <int N> inline hkSimdFloat32 hkVector4f::lengthSquared() const { return dot<N>(*this); } diff --git a/lib/hkStubs/Havok/Physics2012/Collide/Shape/Convex/Capsule/hkpCapsuleShape.h b/lib/hkStubs/Havok/Physics2012/Collide/Shape/Convex/Capsule/hkpCapsuleShape.h index d46634f2..d0de3ec9 100644 --- a/lib/hkStubs/Havok/Physics2012/Collide/Shape/Convex/Capsule/hkpCapsuleShape.h +++ b/lib/hkStubs/Havok/Physics2012/Collide/Shape/Convex/Capsule/hkpCapsuleShape.h @@ -17,7 +17,7 @@ public: hkpCapsuleShape() = default; hkpCapsuleShape(const hkVector4& vertexA, const hkVector4& vertexB, hkReal radius); explicit hkpCapsuleShape(hkFinishLoadedObjectFlag flag); - virtual ~hkpCapsuleShape(); + ~hkpCapsuleShape() override; HK_FORCE_INLINE void getSupportingVertex(hkVector4Parameter direction, hkcdVertex& supportingVertexOut) const override; @@ -57,3 +57,16 @@ protected: // The line's second point. hkVector4 m_vertexB; }; + +inline const hkVector4* hkpCapsuleShape::getVertices() const { + return &m_vertexA; +} + +inline const hkVector4& hkpCapsuleShape::getVertex(int i) const { + return getVertices()[i]; +} + +template <int I> +inline const hkVector4& hkpCapsuleShape::getVertex() const { + return getVertices()[I]; +} |
