Browse Source

Fix controlled flight bug

fControlledFlight state should be handled outside of the physics step.
Skoader 12 years ago committed by Adam Johnson
parent
commit
2f25e04909
  1. 23
      Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp
  2. 4
      Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.h

23
Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp

@ -503,15 +503,6 @@ void plWalkingStrategy::Update(float delSecs)
fImpactVelocity = (hsVector3)fController->GetLocalRotation().Rotate(&fImpactVelocity);
fClearImpact = false;
}
if (fControlledFlight != 0)
{
if (IsOnGround())
fControlledFlightTime = fTimeInAir;
if (fControlledFlightTime > kControlledFlightThreshold)
EnableControlledFlight(false);
}
}
void plWalkingStrategy::AddContactNormals(hsVector3& vec)
@ -535,6 +526,20 @@ void plWalkingStrategy::Reset(bool newAge)
}
}
void plWalkingStrategy::RecalcVelocity(double timeNow, float elapsed, bool useAnim)
{
if (fControlledFlight != 0)
{
if (IsOnGround())
fControlledFlightTime = fTimeInAir;
if (fControlledFlightTime > kControlledFlightThreshold)
EnableControlledFlight(false);
}
plAnimatedMovementStrategy::RecalcVelocity(timeNow, elapsed, useAnim);
}
bool plWalkingStrategy::EnableControlledFlight(bool status)
{
if (status)

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

@ -214,7 +214,7 @@ public:
plAnimatedMovementStrategy(plAGApplicator* rootApp, plPhysicalControllerCore* controller);
virtual ~plAnimatedMovementStrategy() { }
void RecalcVelocity(double timeNow, float elapsed, bool useAnim = true);
virtual void RecalcVelocity(double timeNow, float elapsed, bool useAnim = true);
void SetTurnStrength(float val) { fTurnStr = val; }
float GetTurnStrength() const { return fTurnStr; }
@ -240,6 +240,8 @@ public:
virtual void AddContactNormals(hsVector3& vec);
virtual void Reset(bool newAge);
virtual void RecalcVelocity(double timeNow, float elapsed, bool useAnim = true);
bool HitGroundInThisAge() const { return fHitGroundInThisAge; }
bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; }

Loading…
Cancel
Save