diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index a80453959e..57bd45ca4d 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -440,6 +440,10 @@ namespace Nif { "bhkPhysicsSystem", &construct }, { "bhkRagdollSystem", &construct }, + // Action records + { "bhkLiquidAction", &construct }, + { "bhkOrientHingedBodyAction", &construct }, + // PROPERTIES // 4.0.0.2 diff --git a/components/nif/physics.cpp b/components/nif/physics.cpp index 616e5721de..139f6dda41 100644 --- a/components/nif/physics.cpp +++ b/components/nif/physics.cpp @@ -954,4 +954,36 @@ namespace Nif nif->read(mRemoveWhenBroken); } + void bhkUnaryAction::read(NIFStream* nif) + { + mEntity.read(nif); + nif->skip(8); // Unused + } + + void bhkUnaryAction::post(Reader& nif) + { + mEntity.post(nif); + } + + void bhkLiquidAction::read(NIFStream* nif) + { + nif->skip(12); // Unused + nif->read(mInitialStickForce); + nif->read(mStickStrength); + nif->read(mNeighborDistance); + nif->read(mNeighborStrength); + } + + void bhkOrientHingedBodyAction::read(NIFStream* nif) + { + bhkUnaryAction::read(nif); + + nif->skip(8); // Unused + nif->read(mHingeAxisLS); + nif->read(mForwardLS); + nif->read(mStrength); + nif->read(mDamping); + nif->skip(8); // Unused + } + } // Namespace diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index ff8e23313a..4b8571e20e 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -875,5 +875,38 @@ namespace Nif void read(NIFStream* nif) override; }; + // Abstract action applied during the simulation + struct bhkAction : bhkSerializable + { + }; + + struct bhkUnaryAction : bhkAction + { + bhkRigidBodyPtr mEntity; + + void read(NIFStream* nif) override; + void post(Reader& nif) override; + }; + + struct bhkLiquidAction : bhkAction + { + float mInitialStickForce; + float mStickStrength; + float mNeighborDistance; + float mNeighborStrength; + + void read(NIFStream* nif) override; + }; + + struct bhkOrientHingedBodyAction : bhkUnaryAction + { + osg::Vec4f mHingeAxisLS; + osg::Vec4f mForwardLS; + float mStrength; + float mDamping; + + void read(NIFStream* nif) override; + }; + } // Namespace #endif diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 4b05e15da5..6c7f802f8c 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -54,12 +54,14 @@ namespace Nif RC_bhkConvexVerticesShape, RC_bhkHingeConstraint, RC_bhkLimitedHingeConstraint, + RC_bhkLiquidAction, RC_bhkListShape, RC_bhkMalleableConstraint, RC_bhkMeshShape, RC_bhkMoppBvTreeShape, RC_bhkMultiSphereShape, RC_bhkNiTriStripsShape, + RC_bhkOrientHingedBodyAction, RC_bhkPackedNiTriStripsShape, RC_bhkPlaneShape, RC_bhkPhysicsSystem,