1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-19 11:49:09 +00:00

Only apply height correction to human avatars.

This commit is contained in:
Skoader
2012-11-12 01:40:30 +11:00
parent 79377e2b95
commit 2c06d3b2d3
4 changed files with 15 additions and 9 deletions

View File

@ -2006,7 +2006,7 @@ hsBool plArmatureMod::ValidatePhysics()
return false; return false;
if (!fController) if (!fController)
fController = plPhysicalControllerCore::Create(GetTarget(0)->GetKey(), fPhysHeight, fPhysWidth); fController = plPhysicalControllerCore::Create(GetTarget(0)->GetKey(), fPhysHeight, fPhysWidth, (fBodyType == kBoneBaseMale || fBodyType == kBoneBaseFemale));
if (fController) if (fController)
{ {

View File

@ -150,7 +150,7 @@ public:
hsScalar GetHeight() const { return fHeight; } hsScalar GetHeight() const { return fHeight; }
// Create a new controller instance - Implemented in the physics system // Create a new controller instance - Implemented in the physics system
static plPhysicalControllerCore* Create(plKey ownerSO, hsScalar height, hsScalar radius); static plPhysicalControllerCore* Create(plKey ownerSO, hsScalar height, hsScalar radius, bool human);
protected: protected:
virtual void IHandleEnableChanged() = 0; virtual void IHandleEnableChanged() = 0;

View File

@ -155,23 +155,24 @@ public:
} }
} gControllerHitReport; } gControllerHitReport;
plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, hsScalar height, hsScalar width) plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, hsScalar height, hsScalar width, bool human)
{ {
if (!plPXPhysicalControllerCore::fPXControllersMax || gControllers.size() < plPXPhysicalControllerCore::fPXControllersMax) if (!plPXPhysicalControllerCore::fPXControllersMax || gControllers.size() < plPXPhysicalControllerCore::fPXControllersMax)
{ {
hsScalar radius = width / 2.0f; hsScalar radius = width / 2.0f;
hsScalar realHeight = height - width; hsScalar realHeight = height - width;
return TRACKED_NEW plPXPhysicalControllerCore(ownerSO, realHeight, radius); return TRACKED_NEW plPXPhysicalControllerCore(ownerSO, realHeight, radius, human);
} }
return nil; return nil;
} }
plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius) plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius, bool human)
: plPhysicalControllerCore(ownerSO, height, radius), : plPhysicalControllerCore(ownerSO, height, radius),
fController(nil), fController(nil),
fActor(nil), fActor(nil),
fProxyGen(nil), fProxyGen(nil),
fKinematicCCT(true) fKinematicCCT(true),
fHuman(human)
{ {
ICreateController(fLocalPosition); ICreateController(fLocalPosition);
fActor->raiseActorFlag(NX_AF_DISABLE_COLLISION); 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. // 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. // It is hardcoded at 0.8 which doesn't suit, so we have to manually adjust its dimensions.
float kineRadius = fRadius + kCCTSkinWidth; float kineRadius = fRadius + kCCTSkinWidth;
float kineHeight = fHeight + kPhysHeightCorrection; float kineHeight = fHeight;
NxCapsuleShape* capShape = shape->isCapsule(); NxCapsuleShape* capShape = shape->isCapsule();
if (fHuman)
{
kineHeight += kPhysHeightCorrection;
capShape->setLocalPosition(NxVec3(0.0f, (kPhysHeightCorrection / 2.0f), 0.0f));
}
capShape->setDimensions(kineRadius, kineHeight); capShape->setDimensions(kineRadius, kineHeight);
capShape->setLocalPosition(NxVec3(0.0f, (kPhysHeightCorrection / 2.0f), 0.0f));
} }
else else
{ {

View File

@ -65,7 +65,7 @@ public:
class plPXPhysicalControllerCore: public plPhysicalControllerCore class plPXPhysicalControllerCore: public plPhysicalControllerCore
{ {
public: public:
plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius); plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius, bool human);
~plPXPhysicalControllerCore(); ~plPXPhysicalControllerCore();
// An ArmatureMod has its own idea about when physics should be enabled/disabled. // An ArmatureMod has its own idea about when physics should be enabled/disabled.
@ -169,4 +169,5 @@ protected:
plPhysicalProxy* fProxyGen; plPhysicalProxy* fProxyGen;
bool fKinematicCCT; bool fKinematicCCT;
bool fHuman;
}; };