Browse Source

Merged in "Fix Landing Behaviors" (http://foundry.openuru.org/fisheye/cru/CWE-10)

Fix Landing Behaviors

How to Verify: The avatar should now land on the ground from jumps as in PotS. Therefore, standing jumps produce a full landing, downhill jumps produce a blended landing based on how far down the avatar fell, and uphill jumps produce no landing.
avatar-spawn
Christian Walther 12 years ago
parent
commit
17284220bc
  1. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp
  2. 4
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.h
  3. 6
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp
  4. 1
      MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h

4
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.cpp

@ -65,14 +65,14 @@ hsQuat::hsQuat(hsScalar rad, const hsVector3* axis)
fZ = axis->fZ*s;
}
hsQuat hsQuat::Inverse()
hsQuat hsQuat::Inverse() const
{
hsQuat q2 = Conjugate();
hsScalar msInv = 1.0f/q2.MagnitudeSquared();
return (q2 * msInv);
}
hsPoint3 hsQuat::Rotate(const hsScalarTriple* v)
hsPoint3 hsQuat::Rotate(const hsScalarTriple* v) const
{
hsQuat qInv = Inverse();
hsQuat qVec(v->fX, v->fY, v->fZ, 0);

4
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/CoreLib/hsQuat.h

@ -71,7 +71,7 @@ public:
{ fX = X; fY = Y; fZ = Z; fW = W; }
void GetAngleAxis(hsScalar *rad, hsVector3 *axis) const;
void SetAngleAxis(const hsScalar rad, const hsVector3 &axis);
hsPoint3 Rotate(const hsScalarTriple* v);
hsPoint3 Rotate(const hsScalarTriple* v) const;
// Access operators
hsScalar& operator[](int i) { return (&fX)[i]; }
@ -94,7 +94,7 @@ public:
hsScalar MagnitudeSquared();
hsQuat Conjugate() const
{ return hsQuat(-fX,-fY,-fZ,fW); }
hsQuat Inverse();
hsQuat Inverse() const;
// Binary operators
hsQuat operator-(const hsQuat&) const;
hsQuat operator+(const hsQuat&) const;

6
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp

@ -133,8 +133,12 @@ void plWalkingController::RecalcVelocity(double timeNow, double timePrev, hsBool
if (fController && !fWalkingStrategy->IsOnGround())
{
// PhysX Hack
// LinearVelocity is always (0,0,0) outside the PhysController
fImpactTime = fWalkingStrategy->GetAirTime();
fImpactVelocity = fController->GetLinearVelocity();
fImpactVelocity = fController->GetAchievedLinearVelocity();
// convert orientation from subworld to avatar-local coordinates
fImpactVelocity = (hsVector3)fController->GetLocalRotation().Rotate(&fImpactVelocity);
fClearImpact = false;
}
else

1
MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h

@ -147,6 +147,7 @@ public:
virtual void CheckAndHandleAnyStateChanges();
virtual void UpdateSubstepNonPhysical();
virtual const hsPoint3& GetLocalPosition()=0;
const hsQuat& GetLocalRotation() { return fLocalRotation; }
virtual void MoveActorToSim();
virtual void OverrideAchievedVelocity(hsVector3 newAchievedVel)

Loading…
Cancel
Save