1
0
forked from 0ad/0ad

Fixed a bug that could cause corpses to "wiggle" if a unit died while moving.

This was SVN commit r4532.
This commit is contained in:
Matei 2006-10-09 04:32:27 +00:00
parent 4fb0f2ae5d
commit 4730ed0276
2 changed files with 10 additions and 2 deletions

View File

@ -246,8 +246,7 @@ void CEntity::kill()
updateCollisionPatch();
me = HEntity(); // will deallocate the entity, assuming nobody else has a reference to it
me = HEntity(); // will deallocate the entity, assuming nobody else has a reference to it
}
void CEntity::SetPlayer(CPlayer *pPlayer)

View File

@ -390,6 +390,15 @@ bool CEntity::Kill( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(arg
if( m_actor && m_actor->GetRandomAnimation( "death" ) != m_actor->GetRandomAnimation( "idle" ) )
{
// Prevent "wiggling" as we try to interpolate between here and our death position (if we were moving)
m_graphics_position = m_position;
m_position_previous = m_position;
m_graphics_orientation = m_orientation;
m_orientation_previous = m_orientation;
updateActorTransforms();
// Play death animation and keep the actor in the game in a dead state
// (TODO: remove the actor after some time through some kind of fading mechanism)
m_actor->SetEntitySelection( "death" );
m_actor->SetRandomAnimation( "death", true );
}