fixed flight control code
This commit is contained in:
parent
bb14d9689f
commit
40ec636291
@ -202,7 +202,7 @@ const float fSeaPropFallOff = 2.3f;
|
|||||||
const float fSeaThrust = 0.002f;
|
const float fSeaThrust = 0.002f;
|
||||||
const float fSeaSideSlipMult = 0.1f;
|
const float fSeaSideSlipMult = 0.1f;
|
||||||
const float fSeaRudderMult = 0.01f;
|
const float fSeaRudderMult = 0.01f;
|
||||||
const float fSeaYawMult = 0.0003f;
|
const float fSeaYawMult = -0.0003f;
|
||||||
const float fSeaRollMult = 0.0015f;
|
const float fSeaRollMult = 0.0015f;
|
||||||
const float fSeaRollStabilise = -0.01f;
|
const float fSeaRollStabilise = -0.01f;
|
||||||
const float fSeaPitchMult = 0.0002f;
|
const float fSeaPitchMult = 0.0002f;
|
||||||
@ -316,7 +316,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
|
|
||||||
CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f));
|
CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f));
|
||||||
CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight;
|
CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight;
|
||||||
float fStabiliseDirection = (GetUp().z > 0.0f) ? -1.0f : 1.0f;
|
float fStabiliseDirection = (GetRight().z > 0.0f) ? -1.0f : 1.0f;
|
||||||
float fStabiliseImpulse;
|
float fStabiliseImpulse;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fStabiliseImpulse = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
|
fStabiliseImpulse = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
|
||||||
@ -332,14 +332,14 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
|
fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
|
||||||
else
|
else
|
||||||
fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
|
fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
|
||||||
ApplyTurnForce(fPitchImpulse* m_fTurnMass* GetRight()* CTimer::GetTimeStep(), vecWidthForward);
|
ApplyTurnForce(fPitchImpulse* m_fTurnMass* GetUp()* CTimer::GetTimeStep(), vecWidthForward);
|
||||||
|
|
||||||
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
|
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
|
||||||
float fLiftImpluse;
|
float fLiftImpluse;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fLiftImpluse = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
|
fLiftImpluse = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
|
||||||
else
|
else
|
||||||
fLiftImpluse = fSeaAttackLiftMult * fLift + fSeaFormLiftMult * fForwSpeed * fForwSpeed;
|
fLiftImpluse = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
|
||||||
float fLiftForce = fLiftImpluse * m_fMass * CTimer::GetTimeStep();
|
float fLiftForce = fLiftImpluse * m_fMass * CTimer::GetTimeStep();
|
||||||
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpluse) {
|
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpluse) {
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)
|
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)
|
||||||
|
Loading…
Reference in New Issue
Block a user