diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp index f155d6ef..cf0d2cdf 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp @@ -1993,7 +1993,7 @@ bool plArmatureMod::ValidatePhysics() return false; if (!fController) - fController = plPhysicalControllerCore::Create(GetTarget(0)->GetKey(), fPhysHeight, fPhysWidth); + fController = plPhysicalControllerCore::Create(GetTarget(0)->GetKey(), fPhysHeight, fPhysWidth, (fBodyType == kBoneBaseMale || fBodyType == kBoneBaseFemale)); if (fController) { diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h index 97af7f48..b0c3f9a7 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h @@ -150,7 +150,7 @@ public: float GetHeight() const { return fHeight; } // Create a new controller instance - Implemented in the physics system - static plPhysicalControllerCore* Create(plKey ownerSO, float height, float radius); + static plPhysicalControllerCore* Create(plKey ownerSO, float height, float radius, bool human); protected: virtual void IHandleEnableChanged() = 0; diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp index 127df59c..ef595a72 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp @@ -155,23 +155,24 @@ public: } } gControllerHitReport; -plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, float height, float width) +plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, float height, float width, bool human) { if (!plPXPhysicalControllerCore::fPXControllersMax || gControllers.size() < plPXPhysicalControllerCore::fPXControllersMax) { float radius = width / 2.0f; float realHeight = height - width; - return new plPXPhysicalControllerCore(ownerSO, realHeight, radius); + return new plPXPhysicalControllerCore(ownerSO, realHeight, radius, human); } return nil; } -plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, float height, float radius) +plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, float height, float radius, bool human) : plPhysicalControllerCore(ownerSO, height, radius), fController(nil), fActor(nil), fProxyGen(nil), - fKinematicCCT(true) + fKinematicCCT(true), + fHuman(human) { ICreateController(fLocalPosition); fActor->raiseActorFlag(NX_AF_DISABLE_COLLISION); @@ -724,10 +725,14 @@ void plPXPhysicalControllerCore::ICreateController(const hsPoint3& pos) // In PhysX 2, the kinematic actors scale factor isn't exposed. // It is hardcoded at 0.8 which doesn't suit, so we have to manually adjust its dimensions. float kineRadius = fRadius + kCCTSkinWidth; - float kineHeight = fHeight + kPhysHeightCorrection; + float kineHeight = fHeight; NxCapsuleShape* capShape = shape->isCapsule(); + if (fHuman) + { + kineHeight += kPhysHeightCorrection; + capShape->setLocalPosition(NxVec3(0.0f, (kPhysHeightCorrection / 2.0f), 0.0f)); + } capShape->setDimensions(kineRadius, kineHeight); - capShape->setLocalPosition(NxVec3(0.0f, (kPhysHeightCorrection / 2.0f), 0.0f)); } else { diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h index 4e80b6ff..70ff44d1 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h @@ -65,7 +65,7 @@ public: class plPXPhysicalControllerCore: public plPhysicalControllerCore { public: - plPXPhysicalControllerCore(plKey ownerSO, float height, float radius); + plPXPhysicalControllerCore(plKey ownerSO, float height, float radius, bool human); ~plPXPhysicalControllerCore(); // An ArmatureMod has its own idea about when physics should be enabled/disabled. @@ -169,4 +169,5 @@ protected: plPhysicalProxy* fProxyGen; bool fKinematicCCT; + bool fHuman; };