Fixed bug with fall damage
If you change the height after overheat, you get damage like you didn't change it at all. For example: overheat when you are 10 meters above the ground, and you fall to place 20 meters deeper, but you get the damage like you fell from 10 meters instead of 30. This commit fix this.dev-ui
parent
3bb951119e
commit
244ca93cf7
|
@ -1613,7 +1613,7 @@ bool CPhysics::EventFrame(const Event &event)
|
|||
|
||||
if ( m_bLand && m_fallingHeight != 0.0f ) // if fell
|
||||
{
|
||||
float force = m_fallingHeight * m_fallDamageFraction;
|
||||
float force = (m_fallingHeight - m_object->GetPosition(0).y) * m_fallDamageFraction;
|
||||
m_object->ExploObject(EXPLO_BOUM, force);
|
||||
m_fallingHeight = 0.0f;
|
||||
}
|
||||
|
@ -3901,7 +3901,7 @@ Error CPhysics::GetError()
|
|||
void CPhysics::SetFalling()
|
||||
{
|
||||
if (m_fallingHeight == 0.0f && m_floorHeight >= m_minFallingHeight)
|
||||
m_fallingHeight = m_floorHeight;
|
||||
m_fallingHeight = m_object->GetPosition(0).y;
|
||||
}
|
||||
|
||||
float CPhysics::GetFallingHeight()
|
||||
|
|
Loading…
Reference in New Issue