本文整理汇总了C++中IPhysicsObject::GetContents方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::GetContents方法的具体用法?C++ IPhysicsObject::GetContents怎么用?C++ IPhysicsObject::GetContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::GetContents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pEntity -
// modelIndex -
// &origin -
// &angles -
// *pSolid -
// Output : IPhysicsObject
//-----------------------------------------------------------------------------
IPhysicsObject *PhysModelCreate( CBaseEntity *pEntity, int modelIndex, const Vector &origin, const QAngle &angles, solid_t *pSolid )
{
vcollide_t *pCollide = modelinfo->GetVCollide( modelIndex );
if ( !pCollide || !pCollide->solidCount )
return NULL;
solid_t tmpSolid;
if ( !pSolid )
{
pSolid = &tmpSolid;
if ( !PhysModelParseSolidByIndex( tmpSolid, pEntity, pCollide, -1 ) )
return NULL;
}
int surfaceProp = -1;
if ( pSolid->surfaceprop[0] )
{
surfaceProp = physprops->GetSurfaceIndex( pSolid->surfaceprop );
}
IPhysicsObject *pObject = physenv->CreatePolyObject( pCollide->solids[pSolid->index], surfaceProp, origin, angles, &pSolid->params );
//PhysCheckAdd( pObject, STRING(pEntity->m_iClassname) );
if ( pObject )
{
if ( modelinfo->GetModelType(modelinfo->GetModel(modelIndex)) == mod_brush )
{
unsigned int contents = modelinfo->GetModelContents( modelIndex );
Assert(contents!=0);
// HACKHACK: contents is used to filter collisions
// HACKHACK: So keep solid on for water brushes since they should pass collision rules (as triggers)
if ( contents & MASK_WATER )
{
contents |= CONTENTS_SOLID;
}
if ( contents != pObject->GetContents() && contents != 0 )
{
pObject->SetContents( contents );
pObject->RecheckCollisionFilter();
}
}
g_pPhysSaveRestoreManager->AssociateModel( pObject, modelIndex);
}
return pObject;
}
示例2: STRING
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pEntity -
// modelIndex -
// &origin -
// &angles -
// Output : IPhysicsObject
//-----------------------------------------------------------------------------
IPhysicsObject *PhysModelCreateUnmoveable( CBaseEntity *pEntity, int modelIndex, const Vector &origin, const QAngle &angles )
{
vcollide_t *pCollide = modelinfo->GetVCollide( modelIndex );
if ( !pCollide || !pCollide->solidCount )
return NULL;
solid_t solid;
if ( !PhysModelParseSolidByIndex( solid, pEntity, pCollide, -1 ) )
return NULL;
// collisions are off by default
solid.params.enableCollisions = true;
//solid.params.mass = 1.0;
int surfaceProp = -1;
if ( solid.surfaceprop[0] )
{
surfaceProp = physprops->GetSurfaceIndex( solid.surfaceprop );
}
solid.params.pGameData = static_cast<void *>(pEntity);
solid.params.pName = STRING(pEntity->GetModelName());
IPhysicsObject *pObject = physenv->CreatePolyObjectStatic( pCollide->solids[0], surfaceProp, origin, angles, &solid.params );
//PhysCheckAdd( pObject, STRING(pEntity->m_iClassname) );
if ( pObject )
{
if ( modelinfo->GetModelType(modelinfo->GetModel(modelIndex)) == mod_brush )
{
unsigned int contents = modelinfo->GetModelContents( modelIndex );
Assert(contents!=0);
if ( contents != pObject->GetContents() && contents != 0 )
{
pObject->SetContents( contents );
pObject->RecheckCollisionFilter();
}
}
g_pPhysSaveRestoreManager->AssociateModel( pObject, modelIndex);
}
return pObject;
}