void CWeaponGravityGun::DetachObject( void ) { if ( m_hObject ) { #ifndef CLIENT_DLL CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); Pickup_OnPhysGunDrop( m_hObject, pOwner, DROPPED_BY_CANNON ); #endif IPhysicsObject *pPhysics = m_hObject->VPhysicsGetObject(); if ( pPhysics ) { PhysClearGameFlags( pPhysics, FVPHYSICS_PLAYER_HELD ); } m_gravCallback.DetachEntity(); m_hObject = NULL; } }
void CGrabController::DetachEntity( void ) { CBaseEntity *pEntity = GetAttached(); if ( pEntity ) { IPhysicsObject *pPhys = pEntity->VPhysicsGetObject(); if ( pPhys ) { // on the odd chance that it's gone to sleep while under anti-gravity pPhys->Wake(); pPhys->SetDamping( NULL, &m_saveRotDamping ); PhysClearGameFlags( pPhys, FVPHYSICS_PLAYER_HELD ); } } m_attachedEntity = NULL; physenv->DestroyMotionController( m_controller ); m_controller = NULL; }
void CWeaponGravityGun::DetachObject( void ) { if ( m_hObject ) { #ifndef CLIENT_DLL CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); Pickup_OnPhysGunDrop( m_hObject, pOwner, DROPPED_BY_CANNON ); #endif IPhysicsObject *pList[VPHYSICS_MAX_OBJECT_LIST_COUNT]; int count = m_hObject->VPhysicsGetObjectList( pList, ARRAYSIZE(pList) ); for ( int i = 0; i < count; i++ ) { PhysClearGameFlags( pList[i], FVPHYSICS_PLAYER_HELD ); } m_gravCallback.DetachEntity(); m_hObject = NULL; m_physicsBone = 0; } }
//--------------------------------------------------------- //--------------------------------------------------------- void CBounceBomb::OpenHooks( bool bSilent ) { if( !bSilent ) { EmitSound( "NPC_CombineMine.OpenHooks" ); } if( VPhysicsGetObject() ) { // It's possible to not have a valid physics object here, since this function doubles as an initialization function. PhysClearGameFlags( VPhysicsGetObject(), FVPHYSICS_CONSTRAINT_STATIC ); VPhysicsGetObject()->EnableMotion( true ); } SetPoseParameter( m_iAllHooks, BOUNCEBOMB_HOOK_RANGE ); #ifdef _XBOX RemoveEffects( EF_NOSHADOW ); #endif }
void CGrabController::DetachEntity( bool bClearVelocity ) { Assert(!PhysIsInCallback()); CBaseEntity *pEntity = GetAttached(); if ( pEntity ) { // Restore the LS blocking state pEntity->SetBlocksLOS( m_bCarriedEntityBlocksLOS ); IPhysicsObject *pList[VPHYSICS_MAX_OBJECT_LIST_COUNT]; int count = pEntity->VPhysicsGetObjectList( pList, ARRAYSIZE(pList) ); for ( int i = 0; i < count; i++ ) { IPhysicsObject *pPhys = pList[i]; if ( !pPhys ) continue; // on the odd chance that it's gone to sleep while under anti-gravity pPhys->EnableDrag( true ); pPhys->Wake(); pPhys->SetMass( m_savedMass[i] ); pPhys->SetDamping( NULL, &m_savedRotDamping[i] ); PhysClearGameFlags( pPhys, FVPHYSICS_PLAYER_HELD ); if ( bClearVelocity ) { PhysForceClearVelocity( pPhys ); } else { ClampPhysicsVelocity( pPhys, player_walkspeed.GetFloat() * 1.5f, 2.0f * 360.0f ); } } } m_attachedEntity = NULL; physenv->DestroyMotionController( m_controller ); m_controller = NULL; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CRagdollProp::ClearFlagsThink( void ) { PhysClearGameFlags( VPhysicsGetObject(), FVPHYSICS_WAS_THROWN ); m_bFirstCollisionAfterLaunch = false; SetThink( NULL ); }