diff options
author | aap <aap@papnet.eu> | 2019-07-24 23:06:48 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-24 23:06:48 +0200 |
commit | 93d55bd029b62224a0690bc06bf5d9d6126e59ce (patch) | |
tree | 562f096661118d2f1a6f688eb7d18c20d4746f66 /src/vehicles/Floater.cpp | |
parent | ae69aaf5ce8eca137bd5da85e26c63a5027e049d (diff) |
fixed buoyancy; implemented CAutomobile::ProcessBuoyancy
Diffstat (limited to 'src/vehicles/Floater.cpp')
-rw-r--r-- | src/vehicles/Floater.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp index cabe00c3..6b8bf755 100644 --- a/src/vehicles/Floater.cpp +++ b/src/vehicles/Floater.cpp @@ -22,7 +22,7 @@ static float fBoatVolumeDistribution[9] = { }; bool -cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *impulse, CVector *point) +cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *point, CVector *impulse) { m_numSteps = 2.0f; @@ -32,7 +32,7 @@ cBuoyancy::ProcessBuoyancy(CPhysical *phys, float buoyancy, CVector *impulse, CV PreCalcSetup(phys, buoyancy); SimpleCalcBuoyancy(); - float f = CalcBuoyancyForce(phys, impulse, point); + float f = CalcBuoyancyForce(phys, point, impulse); if(m_isBoat) return true; return f != 0.0f; @@ -82,7 +82,7 @@ cBuoyancy::PreCalcSetup(CPhysical *phys, float buoyancy) m_haveVolume = false; m_numPartialVolumes = 1.0f; m_volumeUnderWater = 0.0f; - m_impulse = CVector(0.0f, 0.0f, 0.0f); + m_impulsePoint = CVector(0.0f, 0.0f, 0.0f); m_position = phys->GetPosition(); m_positionZ = CVector(0.0f, 0.0f, m_position.z); m_buoyancy = buoyancy; @@ -148,7 +148,7 @@ cBuoyancy::SimpleSumBuoyancyData(CVector &waterLevel, tWaterLevel waterPosition) fFraction = 1.0f/m_numPartialVolumes; fRemainingSlice = 1.0f - fFraction; - m_impulse = m_impulse*fRemainingSlice + AverageOfWaterLevel*fThisVolume*fFraction; + m_impulsePoint = m_impulsePoint*fRemainingSlice + AverageOfWaterLevel*fThisVolume*fFraction; m_numPartialVolumes += 1.0f; m_haveVolume = true; return fThisVolume; @@ -175,13 +175,13 @@ cBuoyancy::FindWaterLevel(const CVector &zpos, CVector *waterLevel, tWaterLevel } bool -cBuoyancy::CalcBuoyancyForce(CPhysical *phys, CVector *impulse, CVector *point) +cBuoyancy::CalcBuoyancyForce(CPhysical *phys, CVector *point, CVector *impulse) { if(!m_haveVolume) return false; - *impulse = Multiply3x3(m_matrix, m_impulse); - *point = CVector(0.0f, 0.0f, m_volumeUnderWater*m_buoyancy*CTimer::GetTimeStep()); + *point = Multiply3x3(m_matrix, m_impulsePoint); + *impulse = CVector(0.0f, 0.0f, m_volumeUnderWater*m_buoyancy*CTimer::GetTimeStep()); return true; } |