CommonLibVR
hkpMotion.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/H/hkBaseTypes.h"
4 #include "RE/H/hkMotionState.h"
6 #include "RE/H/hkVector4.h"
7 
8 namespace RE
9 {
10  class hkMatrix3;
11  class hkQuaternion;
12  class hkTransform;
13  class hkpMaxSizeMotion;
14 
16  {
17  public:
18  inline static constexpr auto RTTI = RTTI_hkpMotion;
19  inline static constexpr auto VTABLE = VTABLE_hkpMotion;
20 
21  enum
22  {
24  };
25 
26  enum class MotionType
27  {
28  kInvalid,
29  kDynamic,
32  kKeyframed,
33  kFixed,
35  kCharacter,
36 
37  kTotal
38  };
39 
40  ~hkpMotion() override; // 00
41 
42  // add
43  virtual void SetMass(float a_mass); // 03 - { SetMassInv(a_mass); }
44  virtual void SetMassInv(float a_massInv); // 04 - { inertiaAndMassInv.quad.m128_f32[3] = a_massInv; }
45  virtual void GetInertiaLocal(hkMatrix3& a_inertiaOut) const = 0; // 05
46  virtual void GetInertiaWorld(hkMatrix3& a_inertiaOut) const = 0; // 06
47  virtual void SetInertiaLocal(const hkMatrix3& a_inertia) = 0; // 07
48  virtual void SetInertiaInvLocal(const hkMatrix3& a_inertiaInv) = 0; // 08
49  virtual void GetInertiaInvLocal(hkMatrix3& a_inertiaInvOut) const = 0; // 09
50  virtual void GetInertiaInvWorld(hkMatrix3& a_inertiaInvOut) const = 0; // 0A
51  virtual void SetCenterOfMassInLocal(const hkVector4& a_centerOfMass); // 0B
52  virtual void SetPosition(const hkVector4& a_position); // 0C
53  virtual void SetRotation(const hkQuaternion& a_rotation); // 0D
54  virtual void SetPositionAndRotation(const hkVector4& a_position, const hkQuaternion& a_rotation); // 0E
55  virtual void SetTransform(const hkTransform& a_transform); // 0F
56  virtual void SetLinearVelocity(const hkVector4& a_newVel); // 10 - { linearVelocity = a_newVel; }
57  virtual void SetAngularVelocity(const hkVector4& a_newVel); // 11 - { angularVelocity = a_newVel; }
58  virtual void GetProjectedPointVelocity(const hkVector4& a_point, const hkVector4& a_normal, float& a_velOut, float& a_invVirtMassOut) const = 0; // 12
59  virtual void ApplyLinearImpulse(const hkVector4& a_impulse); // 13
60  virtual void ApplyPointImpulse(const hkVector4& a_impulse, const hkVector4& a_point) = 0; // 14
61  virtual void ApplyAngularImpulse(const hkVector4& a_impulse) = 0; // 15
62  virtual void ApplyForce(const float a_deltaTime, const hkVector4& a_force) = 0; // 16
63  virtual void ApplyForce(const float a_deltaTime, const hkVector4& a_force, const hkVector4& a_point) = 0; // 17
64  virtual void ApplyTorque(const float a_deltaTime, const hkVector4& a_torque) = 0; // 18
66 
67  float GetMass() const
68  {
69  float massInv = inertiaAndMassInv.quad.m128_f32[3];
70  return massInv != 0.0f ? 1.0f / massInv : 0.0f;
71  }
72 
73  // members
75  std::uint8_t deactivationIntegrateCounter; // 011
76  std::uint16_t deactivationNumInactiveFrames[2]; // 012
77  std::uint16_t pad016; // 016
78  std::uint64_t pad018; // 018
84  std::uint32_t deactivationRefOrientation[2]; // 120
86  std::uint16_t savedQualityTypeIndex; // 130
87  std::uint16_t pad132; // 132
89  std::uint64_t pad138; // 138
90  private:
91  KEEP_FOR_RE()
92  };
93  static_assert(sizeof(hkpMotion) == 0x140);
94 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: hkBaseTypes.h:16
Definition: hkMatrix3.h:8
Definition: hkMotionState.h:11
Definition: hkQuaternion.h:8
Definition: hkReferencedObject.h:11
Definition: hkTransform.h:9
Definition: hkVector4.h:9
hkQuadReal quad
Definition: hkVector4.h:53
Definition: hkpKeyframedRigidMotion.h:50
Definition: hkpMotion.h:16
std::uint8_t deactivationIntegrateCounter
Definition: hkpMotion.h:75
stl::enumeration< MotionType, std::uint8_t > type
Definition: hkpMotion.h:74
virtual void GetInertiaInvWorld(hkMatrix3 &a_inertiaInvOut) const =0
hkpMaxSizeMotion * savedMotion
Definition: hkpMotion.h:85
virtual void GetInertiaLocal(hkMatrix3 &a_inertiaOut) const =0
~hkpMotion() override
std::uint64_t pad138
Definition: hkpMotion.h:89
virtual void ApplyAngularImpulse(const hkVector4 &a_impulse)=0
virtual void SetAngularVelocity(const hkVector4 &a_newVel)
virtual void SetInertiaInvLocal(const hkMatrix3 &a_inertiaInv)=0
hkVector4 angularVelocity
Definition: hkpMotion.h:82
virtual void ApplyLinearImpulse(const hkVector4 &a_impulse)
virtual void SetPosition(const hkVector4 &a_position)
virtual void SetRotation(const hkQuaternion &a_rotation)
std::uint16_t pad016
Definition: hkpMotion.h:77
std::uint16_t deactivationNumInactiveFrames[2]
Definition: hkpMotion.h:76
virtual void GetMotionStateAndVelocitiesAndDeactivationType(hkpMotion *a_motionOut)
std::uint64_t pad018
Definition: hkpMotion.h:78
virtual void SetCenterOfMassInLocal(const hkVector4 &a_centerOfMass)
virtual void GetInertiaWorld(hkMatrix3 &a_inertiaOut) const =0
virtual void SetMassInv(float a_massInv)
virtual void GetProjectedPointVelocity(const hkVector4 &a_point, const hkVector4 &a_normal, float &a_velOut, float &a_invVirtMassOut) const =0
virtual void SetPositionAndRotation(const hkVector4 &a_position, const hkQuaternion &a_rotation)
@ kNumInactiveFramesToDeactivate
Definition: hkpMotion.h:23
virtual void SetTransform(const hkTransform &a_transform)
static constexpr auto RTTI
Definition: hkpMotion.h:18
virtual void ApplyPointImpulse(const hkVector4 &a_impulse, const hkVector4 &a_point)=0
virtual void ApplyTorque(const float a_deltaTime, const hkVector4 &a_torque)=0
virtual void ApplyForce(const float a_deltaTime, const hkVector4 &a_force)=0
virtual void ApplyForce(const float a_deltaTime, const hkVector4 &a_force, const hkVector4 &a_point)=0
hkVector4 inertiaAndMassInv
Definition: hkpMotion.h:80
virtual void SetMass(float a_mass)
hkMotionState motionState
Definition: hkpMotion.h:79
hkVector4 deactivationRefPosition[2]
Definition: hkpMotion.h:83
float GetMass() const
Definition: hkpMotion.h:67
std::uint16_t savedQualityTypeIndex
Definition: hkpMotion.h:86
MotionType
Definition: hkpMotion.h:27
virtual void GetInertiaInvLocal(hkMatrix3 &a_inertiaInvOut) const =0
hkHalf gravityFactor
Definition: hkpMotion.h:88
std::uint32_t deactivationRefOrientation[2]
Definition: hkpMotion.h:84
static constexpr auto VTABLE
Definition: hkpMotion.h:19
hkVector4 linearVelocity
Definition: hkpMotion.h:81
virtual void SetLinearVelocity(const hkVector4 &a_newVel)
virtual void SetInertiaLocal(const hkMatrix3 &a_inertia)=0
std::uint16_t pad132
Definition: hkpMotion.h:87
Definition: AbsorbEffect.h:6
constexpr std::array< REL::ID, 1 > VTABLE_hkpMotion
Definition: Offsets_VTABLE.h:14283
constexpr REL::ID RTTI_hkpMotion(static_cast< std::uint64_t >(689848))