diff --git a/include/RE/H/hkpConstraintAtom.h b/include/RE/H/hkpConstraintAtom.h index 55c5aef08..54174c9f5 100644 --- a/include/RE/H/hkpConstraintAtom.h +++ b/include/RE/H/hkpConstraintAtom.h @@ -2,6 +2,8 @@ namespace RE { + class hkpConstraintMotor; + struct hkpConstraintAtom { public: @@ -150,23 +152,23 @@ namespace RE struct hkpAngMotorConstraintAtom : public hkpConstraintAtom { - bool enabled; // 02 - uint8_t motorAxis; // 03 - int16_t initializedOffset; // 04 - int16_t previousTargetAngleOffset; // 06 - int16_t correspondingAngLimitSolverResultOffset; // 08 - float targetAngle; // 0C - uintptr_t motor; // 10 + bool enabled; // 02 + uint8_t motorAxis; // 03 + int16_t initializedOffset; // 04 + int16_t previousTargetAngleOffset; // 06 + int16_t correspondingAngLimitSolverResultOffset; // 08 + float targetAngle; // 0C + hkpConstraintMotor* motor; // 10 }; static_assert(sizeof(hkpAngMotorConstraintAtom) == 0x18); struct hkpRagdollMotorConstraintAtom : public hkpConstraintAtom { - bool enabled; // 02 - int16_t initializedOffset; // 04 - int16_t previousTargetAnglesOffset; // 06 - hkMatrix3 target_bRca; // 10 - uintptr_t motors[3]; // 40 + bool enabled; // 02 + int16_t initializedOffset; // 04 + int16_t previousTargetAnglesOffset; // 06 + hkMatrix3 target_bRca; // 10 + hkpConstraintMotor* motors[3]; // 40 }; static_assert(sizeof(hkpRagdollMotorConstraintAtom) == 0x60); } diff --git a/include/RE/H/hkpConstraintMotor.h b/include/RE/H/hkpConstraintMotor.h new file mode 100644 index 000000000..46e87d520 --- /dev/null +++ b/include/RE/H/hkpConstraintMotor.h @@ -0,0 +1,108 @@ +#pragma once + +#include "RE/H/hkReferencedObject.h" + +namespace RE +{ + class hkpConstraintMotor : public hkReferencedObject + { + public: + enum class MotorType + { + kInvalid = 0, + + kPosition, + kVelocity, + kSpring, + kCallback, + + kNUM + }; + + inline static constexpr auto RTTI = RTTI_hkpConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpConstraintMotor; + + // members + stl::enumeration type; // 10 + }; + static_assert(sizeof(hkpConstraintMotor) == 0x18); + + class hkpLimitedForceConstraintMotor : public hkpConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpLimitedForceConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpLimitedForceConstraintMotor; + + // members + float minForce; // 18 + float maxForce; // 1C + }; + static_assert(sizeof(hkpLimitedForceConstraintMotor) == 0x20); + + class hkpPositionConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpPositionConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpPositionConstraintMotor; + + // members + float tau; // 20 + float damping; // 24 + float proportionalRecoveryVelocity; // 28 + float constantRecoveryVelocity; // 2C + }; + static_assert(sizeof(hkpPositionConstraintMotor) == 0x30); + + class hkpVelocityConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpVelocityConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpVelocityConstraintMotor; + + // members + float tau; // 20 + float targetVelocity; // 24 + bool useConstraintTarget; // 28 + }; + static_assert(sizeof(hkpVelocityConstraintMotor) == 0x30); + + class hkpSpringDamperConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + inline static constexpr auto RTTI = RTTI_hkpSpringDamperConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpSpringDamperConstraintMotor; + + // members + float springConstant; // 20 + float springDamping; // 24 + }; + static_assert(sizeof(hkpSpringDamperConstraintMotor) == 0x28); + + class hkpCallbackConstraintMotor : public hkpLimitedForceConstraintMotor + { + public: + enum class CallbackType + { + kUnk = 0, + + kUser0, + kUser1, + kUser2, + + kNUM + }; + + inline static constexpr auto RTTI = RTTI_hkpCallbackConstraintMotor; + inline static constexpr auto VTABLE = VTABLE_hkpCallbackConstraintMotor; + + using CallbackFunction = void(const hkpCallbackConstraintMotor& motor, const void* unk0, void* unk1); + + // members + CallbackFunction* func; // 20 + stl::enumeration callbackType; // 28 + std::uint64_t userData0; // 30 + std::uint64_t userData1; // 38 + std::uint64_t userData2; // 40 + }; + static_assert(sizeof(hkpCallbackConstraintMotor) == 0x48); +} \ No newline at end of file diff --git a/include/RE/H/hkpLimitedHingeConstraintData.h b/include/RE/H/hkpLimitedHingeConstraintData.h index 2ba81a8e0..4830a79bd 100644 --- a/include/RE/H/hkpLimitedHingeConstraintData.h +++ b/include/RE/H/hkpLimitedHingeConstraintData.h @@ -2,12 +2,29 @@ #include "RE/H/hkpConstraintAtom.h" #include "RE/H/hkpConstraintData.h" +#include "RE/H/hkpSolverResults.h" namespace RE { class hkpLimitedHingeConstraintData : public hkpConstraintData { public: + enum SolverResultType + { + kMotor = 0, + kFriction, + kLimit, + + kAngle0, + kAngle1, + + kLinear0, + kLinear1, + kLinear2, + + kNUM + }; + inline static constexpr auto RTTI = RTTI_hkpLimitedHingeConstraintData; inline static constexpr auto VTABLE = VTABLE_hkpLimitedHingeConstraintData; @@ -23,6 +40,19 @@ namespace RE }; static_assert(sizeof(Atoms) == 0xF0); + struct Runtime + { + inline float getCurrentAngle() + { + return solverResults[SolverResultType::kLimit].data * -1.f; + } + + hkpSolverResults solverResults[SolverResultType::kNUM]; // 00 + bool previousTargetInitialized; // 40 + float previousTargetAngle; // 44 + }; + static_assert(sizeof(Runtime) == 0x48); + // members Atoms atoms; // 18 }; diff --git a/include/RE/H/hkpRagdollConstraintData.h b/include/RE/H/hkpRagdollConstraintData.h index 6195f6409..8f4956ef4 100644 --- a/include/RE/H/hkpRagdollConstraintData.h +++ b/include/RE/H/hkpRagdollConstraintData.h @@ -2,12 +2,34 @@ #include "RE/H/hkpConstraintAtom.h" #include "RE/H/hkpConstraintData.h" +#include "RE/H/hkpSolverResults.h" namespace RE { class hkpRagdollConstraintData : public hkpConstraintData { public: + enum SolverResultType + { + kMotor0 = 0, + kMotor1, + kMotor2, + + kFriction0, + kFriction1, + kFriction2, + + kTwist, + kCone, + kPlane, + + kLinear0, + kLinear1, + kLinear2, + + kNUM + }; + inline static constexpr auto RTTI = RTTI_hkpRagdollConstraintData; inline static constexpr auto VTABLE = VTABLE_hkpRagdollConstraintData; @@ -24,6 +46,15 @@ namespace RE }; static_assert(sizeof(Atoms) == 0x160); + struct Runtime + { + hkpSolverResults solverResults[SolverResultType::kNUM]; // 00 + bool previousTargetInitialized[3]; // 60 + float previousTargetAngle[3]; // 64 + float coneAngle; // 70 + }; + static_assert(sizeof(Runtime) == 0x74); + // members Atoms atoms; // 18 }; diff --git a/include/RE/H/hkpSolverResults.h b/include/RE/H/hkpSolverResults.h new file mode 100644 index 000000000..52da57080 --- /dev/null +++ b/include/RE/H/hkpSolverResults.h @@ -0,0 +1,14 @@ +#pragma once + +namespace RE +{ + + class hkpSolverResults + { + public: + float impulse; // 00 + float data; // 04 + }; + static_assert(sizeof(hkpSolverResults) == 0x08); + +} \ No newline at end of file diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 579e38545..9c0ca6d3f 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -986,6 +986,7 @@ #include "RE/H/hkpConstraintData.h" #include "RE/H/hkpConstraintInfo.h" #include "RE/H/hkpConstraintInstance.h" +#include "RE/H/hkpConstraintMotor.h" #include "RE/H/hkpConstraintOwner.h" #include "RE/H/hkpContactListener.h" #include "RE/H/hkpContactPointEvent.h" @@ -1030,6 +1031,7 @@ #include "RE/H/hkpSimulationIsland.h" #include "RE/H/hkpSingleShapeContainer.h" #include "RE/H/hkpSolverInfo.h" +#include "RE/H/hkpSolverResults.h" #include "RE/H/hkpSphereRepShape.h" #include "RE/H/hkpSphereShape.h" #include "RE/H/hkpTypedBroadPhaseHandle.h"