diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index d6cf1f47d6..c1d355a137 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -183,6 +183,7 @@ namespace Nif { "bhkRigidBodyT", &construct }, { "bhkRagdollConstraint", &construct }, { "bhkHingeConstraint", &construct }, + { "bhkLimitedHingeConstraint", &construct }, { "BSLightingShaderProperty", &construct }, { "BSEffectShaderProperty", &construct }, { "NiSortAdjustNode", &construct }, diff --git a/components/nif/physics.cpp b/components/nif/physics.cpp index af4a573707..c91ac6d021 100644 --- a/components/nif/physics.cpp +++ b/components/nif/physics.cpp @@ -306,6 +306,37 @@ namespace Nif nif->read(mDataB.mPivot); } } + + void bhkLimitedHingeConstraintCInfo::read(NIFStream* nif) + { + if (nif->getBethVersion() <= 16) + { + nif->read(mDataA.mPivot); + nif->read(mDataA.mAxis); + nif->read(mDataA.mPerpAxis1); + nif->read(mDataA.mPerpAxis2); + nif->read(mDataB.mPivot); + nif->read(mDataB.mAxis); + nif->read(mDataB.mPerpAxis2); + } + else + { + nif->read(mDataA.mAxis); + nif->read(mDataA.mPerpAxis1); + nif->read(mDataA.mPerpAxis2); + nif->read(mDataA.mPivot); + nif->read(mDataB.mAxis); + nif->read(mDataB.mPerpAxis1); + nif->read(mDataB.mPerpAxis2); + nif->read(mDataB.mPivot); + } + nif->read(mMinAngle); + nif->read(mMaxAngle); + nif->read(mMaxFriction); + if (nif->getVersion() >= NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() > 16) + mMotor.read(nif); + } + /// Record types void bhkCollisionObject::read(NIFStream* nif) @@ -590,4 +621,10 @@ namespace Nif mConstraint.read(nif); } + void bhkLimitedHingeConstraint::read(NIFStream* nif) + { + bhkConstraint::read(nif); + mConstraint.read(nif); + } + } // Namespace diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index 14eab4efa2..cc1a3ba755 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -306,6 +306,23 @@ namespace Nif void read(NIFStream* nif); }; + struct bhkLimitedHingeConstraintCInfo + { + struct HingeData + { + osg::Vec4f mPivot; + osg::Vec4f mAxis; + osg::Vec4f mPerpAxis1; + osg::Vec4f mPerpAxis2; + }; + HingeData mDataA; + HingeData mDataB; + float mMinAngle, mMaxAngle; + float mMaxFriction; + bhkConstraintMotorCInfo mMotor; + void read(NIFStream* nif); + }; + /// Record types // Abstract Bethesda Havok object @@ -548,5 +565,11 @@ namespace Nif void read(NIFStream* nif) override; }; + struct bhkLimitedHingeConstraint : public bhkConstraint + { + bhkLimitedHingeConstraintCInfo mConstraint; + void read(NIFStream* nif) override; + }; + } // Namespace #endif diff --git a/components/nif/record.hpp b/components/nif/record.hpp index d881d9e66d..d669f6993b 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -148,6 +148,7 @@ namespace Nif RC_bhkRigidBodyT, RC_bhkRagdollConstraint, RC_bhkHingeConstraint, + RC_bhkLimitedHingeConstraint, RC_BSLightingShaderProperty, RC_BSEffectShaderProperty, RC_NiClusterAccumulator,