void CProceduralContextRagdoll::QueueRagdoll( bool bAlive ) { if( m_targetEntityId == 0 ) { m_targetEntityId = m_entity->GetId(); } IActor* piActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor( m_targetEntityId ); // NOTE: The case where piActor is NULL is when you're - in the CryMann preview! if(piActor) { if( gEnv->bServer && !m_bDispatchedAspectProfile && (piActor->GetGameObject()->GetAspectProfile(eEA_Physics) != eAP_Ragdoll) ) { m_bEntityAlive = bAlive; piActor->GetGameObject()->SetAspectProfile( eEA_Physics, bAlive ? eAP_Sleep : eAP_Ragdoll ); } else if( !m_bInRagdoll || (m_bInRagdoll && !bAlive && m_bEntityAlive) ) { SRagdollizeParams params; params.mass = static_cast<CActor*>(piActor)->GetActorPhysics().mass; params.sleep = m_bEntityAlive = bAlive; params.stiffness = m_stiffness; SGameObjectEvent event( eGFE_QueueRagdollCreation, eGOEF_ToExtensions ); event.ptr = ¶ms; piActor->GetGameObject()->SendEvent( event ); m_bInRagdoll = true; } else { m_bInBlendOut = true; } } #ifndef _RELEASE else { if( IEntity* pEntity = gEnv->pEntitySystem->GetEntity( m_targetEntityId ) ) { ICharacterInstance *pCharacter = pEntity->GetCharacter(0); if (pCharacter) { // dead guys shouldn't blink pCharacter->EnableProceduralFacialAnimation(false); //Anton :: SetDefaultPose on serialization if(gEnv->pSystem->IsSerializingFile() && pCharacter->GetISkeletonPose()) pCharacter->GetISkeletonPose()->SetDefaultPose(); } SEntityPhysicalizeParams pp; pp.fStiffnessScale = m_stiffness; pp.type = PE_ARTICULATED; pp.nSlot = 0; pp.bCopyJointVelocities = true; //never ragdollize without mass [Anton] pp.mass = (float)__fsel(-pp.mass, 80.0f, pp.mass); pe_player_dimensions playerDim; pe_player_dynamics playerDyn; playerDyn.gravity = Vec3( 0.f, 0.f, -15.0f ); playerDyn.kInertia = 5.5f; pp.pPlayerDynamics = &playerDyn; // Joints velocities are copied by default for now pp.bCopyJointVelocities = !gEnv->pSystem->IsSerializingFile(); pp.nFlagsOR = pef_monitor_poststep; pEntity->Physicalize(pp); m_bInRagdoll = true; } } #endif }