mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Fix the interpolation changes from the previous commit, as they weren't smooth
This was SVN commit r15232.
This commit is contained in:
@@ -485,22 +485,24 @@ public:
|
||||
float x, z, rotY;
|
||||
GetInterpolatedPosition2D(frameOffset, x, z, rotY);
|
||||
|
||||
float y = GetHeightFixed().ToFloat() + Interpolate(0.f, m_LastYDifference.ToFloat(), frameOffset);
|
||||
|
||||
if (forceFloating)
|
||||
|
||||
float baseY = 0;
|
||||
if (m_RelativeToGround)
|
||||
{
|
||||
// if the actor has a <float/> flag, it shouldn't be serialized,
|
||||
// so it's handled here separately
|
||||
CmpPtr<ICmpTerrain> cmpTerrain(GetSystemEntity());
|
||||
CmpPtr<ICmpWaterManager> cmpWaterManager(GetSystemEntity());
|
||||
if (cmpTerrain && cmpWaterManager)
|
||||
if (cmpTerrain)
|
||||
baseY = cmpTerrain->GetExactGroundLevel(x, z);
|
||||
|
||||
if (m_Floating || forceFloating)
|
||||
{
|
||||
float diff = (cmpWaterManager->GetWaterLevel(m_X, m_Z) - cmpTerrain->GetGroundLevel(m_X, m_Z)).ToFloat();
|
||||
if (diff > 0.f)
|
||||
y += diff;
|
||||
CmpPtr<ICmpWaterManager> cmpWaterManager(GetSystemEntity());
|
||||
if (cmpWaterManager)
|
||||
baseY = std::max(baseY, cmpWaterManager->GetExactWaterLevel(x, z));
|
||||
}
|
||||
}
|
||||
|
||||
float y = baseY + m_Y.ToFloat() + Interpolate(m_LastYDifference.ToFloat(), 0.f, frameOffset);
|
||||
|
||||
CMatrix3D m;
|
||||
|
||||
// linear interpolation is good enough (for RotX/Z).
|
||||
|
||||
Reference in New Issue
Block a user