diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index e5cb994637..c4490c4e29 100644 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -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) diff --git a/source/simulation/EntityScriptInterface.cpp b/source/simulation/EntityScriptInterface.cpp index c84d560d7d..9a64092749 100644 --- a/source/simulation/EntityScriptInterface.cpp +++ b/source/simulation/EntityScriptInterface.cpp @@ -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 ); }