void CCharacterPhysicsSupport::in_ChangeVisual() { if(!m_physics_skeleton&&!m_pPhysicsShell) return; if(m_pPhysicsShell) { VERIFY(m_eType!=etStalker); if(m_physics_skeleton) { m_EntityAlife.processing_deactivate() ; m_physics_skeleton->Deactivate() ; xr_delete(m_physics_skeleton) ; } CreateSkeleton(m_physics_skeleton); if(m_pPhysicsShell)m_pPhysicsShell->Deactivate(); xr_delete(m_pPhysicsShell); ActivateShell(NULL); } if(m_ik_controller) { DestroyIKController(); CreateIKController(); } }
void CCharacterPhysicsSupport::SpawnInitPhysics( CSE_Abstract* e ) { if( m_EntityAlife.g_Alive( ) ) { #ifdef DEBUG if( ph_dbg_draw_mask1.test(ph_m1_DbgTrackObject)&&stricmp( PH_DBG_ObjectTrackName( ), *m_EntityAlife.cName( ) )==0 ) { Msg("CCharacterPhysicsSupport::SpawnInitPhysics obj %s before collision correction %f,%f,%f", PH_DBG_ObjectTrackName(), m_EntityAlife.Position().x, m_EntityAlife.Position().y, m_EntityAlife.Position( ).z ); } #endif #ifdef USE_IK if( etStalker == m_eType || etActor == m_eType || (m_EntityAlife.Visual()->dcast_PKinematics()->LL_UserData() && m_EntityAlife.Visual()->dcast_PKinematics()->LL_UserData()->section_exist("ik")) ) CreateIKController( ); #endif VERIFY(pSettings); SpawnCharacterCreate( ); #ifdef DEBUG if( ph_dbg_draw_mask1.test( ph_m1_DbgTrackObject ) && stricmp( PH_DBG_ObjectTrackName( ), *m_EntityAlife.cName()) == 0 ) { Msg( "CCharacterPhysicsSupport::SpawnInitPhysics obj %s after collision correction %f,%f,%f", PH_DBG_ObjectTrackName(),m_EntityAlife.Position( ).x, m_EntityAlife.Position().y, m_EntityAlife.Position().z ); } #endif } else { ActivateShell( NULL ); } }
void CCharacterPhysicsSupport::in_UpdateCL() { if(m_eState==esRemoved) { return; } CalculateTimeDelta(); if(m_pPhysicsShell&&m_pPhysicsShell->isFullActive()) { m_pPhysicsShell->SetRagDoll();//Теперь шела относиться к классу объектов cbClassRagDoll m_pPhysicsShell->InterpolateGlobalTransform(&mXFORM); } if(m_pPhysicsShell) { if(m_pPhysicsShell->isActive()) { if(!m_flags.test(fl_death_anim_on)&&m_pPhysicsShell->isFullActive())//!b_death_anim_on&&m_pPhysicsShell->isFullActive() { { smart_cast<CKinematicsAnimated*>(m_EntityAlife.Visual())->PlayCycle("death_init"); } m_flags.set(fl_death_anim_on,TRUE); } UpdateFrictionAndJointResistanse(); } } else if (!m_EntityAlife.g_Alive()&&!m_EntityAlife.use_simplified_visual ()) { ActivateShell(NULL); m_PhysicMovementControl->DestroyCharacter(); } }
void CCharacterPhysicsSupport::SpawnInitPhysics(CSE_Abstract* e) { //if(!m_physics_skeleton)CreateSkeleton(m_physics_skeleton); if(m_EntityAlife.g_Alive()) { #ifdef DEBUG if(ph_dbg_draw_mask1.test(ph_m1_DbgTrackObject)&&stricmp(PH_DBG_ObjectTrack(),*m_EntityAlife.cName())==0) { Msg("CCharacterPhysicsSupport::SpawnInitPhysics obj %s before collision correction %f,%f,%f",PH_DBG_ObjectTrack(),m_EntityAlife.Position().x,m_EntityAlife.Position().y,m_EntityAlife.Position().z); } #endif CreateIKController(); CreateCharacter(); #ifdef DEBUG if(ph_dbg_draw_mask1.test(ph_m1_DbgTrackObject)&&stricmp(PH_DBG_ObjectTrack(),*m_EntityAlife.cName())==0) { Msg("CCharacterPhysicsSupport::SpawnInitPhysics obj %s after collision correction %f,%f,%f",PH_DBG_ObjectTrack(),m_EntityAlife.Position().x,m_EntityAlife.Position().y,m_EntityAlife.Position().z); } #endif //m_PhysicMovementControl.SetMaterial( ) } else { ActivateShell(NULL); } }
void CCharacterPhysicsSupport::in_Die( ) { if( m_hit_valide_time < Device.dwTimeGlobal || !m_sv_hit.is_valide() ) { if( m_EntityAlife.use_simplified_visual( ) ) return; ActivateShell( NULL ); m_PhysicMovementControl->DestroyCharacter( ); return; } in_Hit( m_sv_hit, true ); }
void CCharacterPhysicsSupport::in_Hit(float P,Fvector &dir, CObject *who,s16 element,Fvector p_in_object_space, float impulse,ALife::EHitType hit_type ,bool is_killing) { if(m_EntityAlife.use_simplified_visual ()) return; if(m_flags.test(fl_block_hit)) { VERIFY(!m_EntityAlife.g_Alive()); if(Device.dwTimeGlobal-m_EntityAlife.GetLevelDeathTime()>=2000) m_flags.set(fl_block_hit,FALSE); else return; } is_killing=is_killing||(m_eState==esAlive&&!m_EntityAlife.g_Alive()); if(m_EntityAlife.g_Alive()&&is_killing&&hit_type==ALife::eHitTypeExplosion&&P>70.f) CPHDestroyable::Destroy(); if((!m_EntityAlife.g_Alive()||is_killing)&&!fis_zero(m_shot_up_factor)&&hit_type!=ALife::eHitTypeExplosion) { dir.y+=m_shot_up_factor; dir.normalize(); } if(!m_pPhysicsShell&&is_killing) { TestForWounded(); ActivateShell(who); if (!m_was_wounded) { impulse*=(hit_type==ALife::eHitTypeExplosion ? 1.f : skel_fatal_impulse_factor); } m_flags.set(fl_block_hit,TRUE); } if(!(m_pPhysicsShell&&m_pPhysicsShell->isActive())) { if(!is_killing&&m_EntityAlife.g_Alive()) m_PhysicMovementControl->ApplyHit(dir,impulse,hit_type); } else { if(m_pPhysicsShell&&m_pPhysicsShell->isActive()) m_pPhysicsShell->applyHit(p_in_object_space,dir,impulse,element,hit_type); } }
void CCharacterPhysicsSupport::in_ChangeVisual() { if(m_ik_controller) { DestroyIKController(); CreateIKController(); } xr_delete( m_interactive_animation ); destroy_animation_collision(); destroy( m_interactive_motion ); IKinematicsAnimated* KA = smart_cast<IKinematicsAnimated*>( m_EntityAlife.Visual( ) ); if( KA ) { m_death_anims.setup( KA, m_EntityAlife.cNameSect().c_str() , pSettings ); if( Type( ) != etBitting ) m_hit_animations.SetupHitMotions( *KA ); } if(!m_physics_skeleton&&!m_pPhysicsShell) return; if(m_pPhysicsShell) { VERIFY(m_eType!=etStalker); if(m_physics_skeleton) { m_EntityAlife.processing_deactivate() ; m_physics_skeleton->Deactivate() ; xr_delete(m_physics_skeleton) ; } CreateSkeleton(m_physics_skeleton); if(m_pPhysicsShell)m_pPhysicsShell->Deactivate(); xr_delete(m_pPhysicsShell); ActivateShell(NULL); } }