CommonLibSSE NG
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()
68  {
69  float mass = reinterpret_cast<float*>(&inertiaAndMassInv.quad)[3];
70  if (mass != 0.0f) {
71  return 1.0f / mass;
72  }
73  return 0.0f;
74  }
75 
76  // members
78  std::uint8_t deactivationIntegrateCounter; // 011
79  std::uint16_t deactivationNumInactiveFrames[2]; // 012
80  std::uint16_t pad016; // 016
81  std::uint64_t pad018; // 018
87  std::uint32_t deactivationRefOrientation[2]; // 120
89  std::uint16_t savedQualityTypeIndex; // 130
90  std::uint16_t pad132; // 132
92  std::uint64_t pad138; // 138
93  };
94  static_assert(sizeof(hkpMotion) == 0x140);
95 }
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:47
Definition: hkpMotion.h:16
std::uint8_t deactivationIntegrateCounter
Definition: hkpMotion.h:78
stl::enumeration< MotionType, std::uint8_t > type
Definition: hkpMotion.h:77
virtual void GetInertiaInvWorld(hkMatrix3 &a_inertiaInvOut) const =0
hkpMaxSizeMotion * savedMotion
Definition: hkpMotion.h:88
virtual void GetInertiaLocal(hkMatrix3 &a_inertiaOut) const =0
~hkpMotion() override
std::uint64_t pad138
Definition: hkpMotion.h:92
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:85
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:80
std::uint16_t deactivationNumInactiveFrames[2]
Definition: hkpMotion.h:79
virtual void GetMotionStateAndVelocitiesAndDeactivationType(hkpMotion *a_motionOut)
std::uint64_t pad018
Definition: hkpMotion.h:81
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)
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:83
virtual void SetMass(float a_mass)
hkMotionState motionState
Definition: hkpMotion.h:82
hkVector4 deactivationRefPosition[2]
Definition: hkpMotion.h:86
std::uint16_t savedQualityTypeIndex
Definition: hkpMotion.h:89
float GetMass()
Definition: hkpMotion.h:67
MotionType
Definition: hkpMotion.h:27
virtual void GetInertiaInvLocal(hkMatrix3 &a_inertiaInvOut) const =0
hkHalf gravityFactor
Definition: hkpMotion.h:91
std::uint32_t deactivationRefOrientation[2]
Definition: hkpMotion.h:87
static constexpr auto VTABLE
Definition: hkpMotion.h:19
hkVector4 linearVelocity
Definition: hkpMotion.h:84
virtual void SetLinearVelocity(const hkVector4 &a_newVel)
virtual void SetInertiaLocal(const hkMatrix3 &a_inertia)=0
std::uint16_t pad132
Definition: hkpMotion.h:90
@ kNumInactiveFramesToDeactivate
Definition: hkpMotion.h:23
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_hkpMotion(689848, 397703, 0x1f59398)
constexpr std::array< REL::VariantID, 1 > VTABLE_hkpMotion
Definition: Offsets_VTABLE.h:4997