void RagdollActivate( ragdoll_t &ragdoll, vcollide_t *pCollide, int modelIndex, bool bForceWake ) { RagdollSetupCollisions( ragdoll, pCollide, modelIndex ); for ( int i = 0; i < ragdoll.listCount; i++ ) { ragdoll.list[i].pObject->SetGameIndex( i ); PhysSetGameFlags( ragdoll.list[i].pObject, FVPHYSICS_MULTIOBJECT_ENTITY ); // now that the relationships are set, activate the collision system ragdoll.list[i].pObject->EnableCollisions( true ); if ( bForceWake == true ) { ragdoll.list[i].pObject->Wake(); } } if ( ragdoll.pGroup ) { // NOTE: This also wakes the objects ragdoll.pGroup->Activate(); // so if we didn't want that, we'll need to put them back to sleep here if ( !bForceWake ) { for ( int i = 0; i < ragdoll.listCount; i++ ) { ragdoll.list[i].pObject->Sleep(); } } } }
void CRagdollProp::OnRestore() { // rebuild element 0 since it isn't saved // NOTE: This breaks the rules - the pointer needs to get fixed in Restore() m_ragdoll.list[0].pObject = VPhysicsGetObject(); m_ragdoll.list[0].parentIndex = -1; m_ragdoll.list[0].originParentSpace.Init(); BaseClass::OnRestore(); if ( !m_ragdoll.listCount ) return; // JAY: Reset collision relationships RagdollSetupCollisions( m_ragdoll, modelinfo->GetVCollide( GetModelIndex() ), GetModelIndex() ); VPhysicsUpdate( VPhysicsGetObject() ); }