Browse Source

Merge pull request #200 from cwalther/landing

Fix direction-dependent landing behaviors
Adam Johnson 13 years ago
parent
commit
b380da4c94
  1. 4
      Sources/Plasma/CoreLib/hsQuat.cpp
  2. 4
      Sources/Plasma/CoreLib/hsQuat.h
  3. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp
  4. 1
      Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h

4
Sources/Plasma/CoreLib/hsQuat.cpp

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

4
Sources/Plasma/CoreLib/hsQuat.h

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

2
Sources/Plasma/PubUtilLib/plAvatar/plAvCallbackAction.cpp

@ -137,6 +137,8 @@ void plWalkingController::RecalcVelocity(double timeNow, double timePrev, hsBool
// always (0,0,0) outside of the controller update proc // always (0,0,0) outside of the controller update proc
fImpactTime = fWalkingStrategy->GetAirTime(); fImpactTime = fWalkingStrategy->GetAirTime();
fImpactVelocity = fController->GetAchievedLinearVelocity(); fImpactVelocity = fController->GetAchievedLinearVelocity();
// convert orientation from subworld to avatar-local coordinates
fImpactVelocity = (hsVector3)fController->GetLocalRotation().Rotate(&fImpactVelocity);
fClearImpact = false; fClearImpact = false;
} }
else else

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

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

Loading…
Cancel
Save