diff --git a/lib/hkStubs/CMakeLists.txt b/lib/hkStubs/CMakeLists.txt index ebde6b0f..495e717e 100644 --- a/lib/hkStubs/CMakeLists.txt +++ b/lib/hkStubs/CMakeLists.txt @@ -95,6 +95,7 @@ add_library(hkStubs OBJECT Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastInput.h Havok/Physics2012/Collide/Util/Welding/hkpWeldingUtility.h + Havok/Physics2012/Dynamics/Collide/hkpResponseModifier.h Havok/Physics2012/Dynamics/Common/hkpMaterial.h Havok/Physics2012/Dynamics/Common/hkpProperty.h Havok/Physics2012/Dynamics/Entity/hkpEntity.h diff --git a/lib/hkStubs/Havok/Physics2012/Dynamics/Collide/hkpResponseModifier.h b/lib/hkStubs/Havok/Physics2012/Dynamics/Collide/hkpResponseModifier.h new file mode 100644 index 00000000..0fe06e79 --- /dev/null +++ b/lib/hkStubs/Havok/Physics2012/Dynamics/Collide/hkpResponseModifier.h @@ -0,0 +1,64 @@ +#pragma once + +#include + +class hkpConstraintInstance; +class hkpConstraintOwner; +class hkpDynamicsContactMgr; +class hkpRigidBody; + +class hkpResponseModifier { +public: + enum Flags { + MASS_SCALING = 1, + CENTER_OF_MASS_DISPLACEMENT = 2, + SURFACE_VELOCITY = 4, + IMPULSE_SCALING = 8, + VISCOUS_SURFACE = 16, + + ADDITIONAL_SIZE_MODIFIERS = MASS_SCALING | CENTER_OF_MASS_DISPLACEMENT | SURFACE_VELOCITY, + }; + + static void setInvMassScalingForContact(hkpDynamicsContactMgr* manager, hkpRigidBody* bodyA, + hkpRigidBody* bodyB, + hkpConstraintOwner& constraintOwner, + const hkVector4& factorA, const hkVector4& factorB); + + static void setInvMassScalingForContact(hkpDynamicsContactMgr* manager, hkpRigidBody* body, + hkpConstraintOwner& constraintOwner, + const hkVector4& factor); + + static void setCenterOfMassDisplacementForContact(hkpDynamicsContactMgr* manager, + hkpRigidBody* bodyA, hkpRigidBody* bodyB, + hkpConstraintOwner& constraintOwner, + const hkVector4& displacementA, + const hkVector4& displacementB); + + static void setImpulseScalingForContact(hkpDynamicsContactMgr* manager, hkpRigidBody* bodyA, + hkpRigidBody* bodyB, + hkpConstraintOwner& constraintOwner, + hkReal usedImpulseFraction, hkReal maxAcceleration); + + static void setSurfaceVelocity(hkpDynamicsContactMgr* manager, hkpRigidBody* body, + hkpConstraintOwner& constraintOwner, const hkVector4& velWorld); + + static void clearSurfaceVelocity(hkpDynamicsContactMgr* manager, + hkpConstraintOwner& constraintOwner, hkpRigidBody* body); + + static void setLowSurfaceViscosity(hkpDynamicsContactMgr* manager, + hkpConstraintOwner& constraintOwner); + + static void disableConstraint(hkpConstraintInstance* instance, + hkpConstraintOwner& constraintOwner); + + static void enableConstraint(hkpConstraintInstance* instance, + hkpConstraintOwner& constraintOwner); + + HK_FORCE_INLINE static hkUint16 getAdditionalSchemaSize(hkUint8 flags); + + static const hkUint16 tableOfAdditionalSchemaSizes[]; +}; + +inline hkUint16 hkpResponseModifier::getAdditionalSchemaSize(hkUint8 flags) { + return tableOfAdditionalSchemaSizes[flags & ADDITIONAL_SIZE_MODIFIERS]; +} diff --git a/src/KingSystem/Physics/RigidBody/physRigidBody.cpp b/src/KingSystem/Physics/RigidBody/physRigidBody.cpp index e228cde2..19f4a29a 100644 --- a/src/KingSystem/Physics/RigidBody/physRigidBody.cpp +++ b/src/KingSystem/Physics/RigidBody/physRigidBody.cpp @@ -1,4 +1,5 @@ #include "KingSystem/Physics/RigidBody/physRigidBody.h" +#include #include #include "KingSystem/Physics/System/physMemSystem.h" @@ -17,7 +18,7 @@ RigidBody::RigidBody(u32 a, u32 mass_scaling, hkpRigidBody* hk_body, const sead: mHkBody->enableDeactivation(true); mHkBody->getCollidableRw()->m_allowedPenetrationDepth = 0.1f; if (mFlags.isOff(Flag1::MassScaling)) { - mHkBody->m_responseModifierFlags |= 1; + mHkBody->m_responseModifierFlags |= hkpResponseModifier::Flags::MASS_SCALING; } mFlags.change(Flag1::_80, _b4 == 5);