本文整理汇总了C++中IPhysicsObject::IsStatic方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::IsStatic方法的具体用法?C++ IPhysicsObject::IsStatic怎么用?C++ IPhysicsObject::IsStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::IsStatic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TransferPhysicsObject
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTriggerPortalCleanser::TransferPhysicsObject( CBaseEntity *pFrom, CBaseEntity *pTo, bool wakeUp )
{
IPhysicsObject *pVPhysics = pFrom->VPhysicsGetObject();
if ( !pVPhysics || pVPhysics->IsStatic() )
return false;
Vector vecVelocity, vecAngular;
pVPhysics->GetVelocity( &vecVelocity, &vecAngular );
// clear out the pointer so it won't get deleted
pFrom->VPhysicsSwapObject( NULL );
// remove any AI behavior bound to it
pVPhysics->RemoveShadowController();
// transfer to the new owner
pTo->VPhysicsSetObject( pVPhysics );
pVPhysics->SetGameData( (void *)pTo );
pTo->VPhysicsUpdate( pVPhysics );
// may have been temporarily disabled by the old object
pVPhysics->EnableMotion( true );
pVPhysics->EnableGravity( false );
// Slow down and push up the object.
vecVelocity /= 2;
vecAngular /= 2;
vecVelocity.z += 10;
pVPhysics->SetVelocity( &vecVelocity, &vecAngular );
// Update for the new entity solid type
pVPhysics->RecheckCollisionFilter();
if ( wakeUp )
{
pVPhysics->Wake();
}
return true;
}
示例2: ObjectSound
void CCollisionEvent::ObjectSound( int index, vcollisionevent_t *pEvent )
{
IPhysicsObject *pObject = pEvent->pObjects[index];
if ( !pObject || pObject->IsStatic() )
return;
float speed = pEvent->collisionSpeed * pEvent->collisionSpeed;
int surfaceProps = pEvent->surfaceProps[index];
void *pGameData = pObject->GetGameData();
if ( pGameData )
{
float volume = speed * (1.0f/(320.0f*320.0f)); // max volume at 320 in/s
if ( volume > 1.0f )
volume = 1.0f;
if ( surfaceProps >= 0 )
{
g_PhysicsSystem.AddImpactSound( pGameData, pObject, surfaceProps, pEvent->surfaceProps[!index], volume, speed );
}
}
}
示例3: TransferPhysicsObject
// UNDONE: Is this worth it?, just recreate the object instead? (that happens when this returns false anyway)
// recreating works, but is more expensive and won't inherit properties (velocity, constraints, etc)
bool TransferPhysicsObject( CBaseEntity *pFrom, CBaseEntity *pTo )
{
IPhysicsObject *pVPhysics = pFrom->VPhysicsGetObject();
if ( !pVPhysics || pVPhysics->IsStatic() )
return false;
// clear out the pointer so it won't get deleted
pFrom->VPhysicsSwapObject( NULL );
// remove any AI behavior bound to it
pVPhysics->RemoveShadowController();
// transfer to the new owner
pTo->VPhysicsSetObject( pVPhysics );
pVPhysics->SetGameData( (void *)pTo );
pTo->VPhysicsUpdate( pVPhysics );
// may have been temporarily disabled by the old object
pVPhysics->EnableMotion( true );
pVPhysics->EnableGravity( true );
// Update for the new entity solid type
pVPhysics->RecheckCollisionFilter();
return true;
}