本文整理汇总了C++中IPhysicsObject::GetSphereRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::GetSphereRadius方法的具体用法?C++ IPhysicsObject::GetSphereRadius怎么用?C++ IPhysicsObject::GetSphereRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::GetSphereRadius方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueueSave
void QueueSave( CBaseEntity *pOwner, typedescription_t *pTypeDesc, void **ppPhysObj, PhysInterfaceId_t type )
{
if ( !pOwner )
return;
bool fOnlyNotingExistence = !pOwner->ShouldSavePhysics();
QueuedItem_t item;
item.ppPhysObj = ppPhysObj;
item.header.hEntity = pOwner;
item.header.type = type;
item.header.nObjects = ( !fOnlyNotingExistence ) ? pTypeDesc->fieldSize : 0;
item.header.fieldName = AllocPooledString( pTypeDesc->fieldName );
// A pooled string is used here because there is no way
// right now to save a non-string_t string and have it
// compressed in the save symbol tables. Furthermore,
// the field name would normally be in the string
// pool anyway. (toml 12-10-02)
item.header.modelName = NULL_STRING;
memset( &item.header.bbox, 0, sizeof( item.header.bbox ) );
item.header.sphere.radius = 0;
if ( !fOnlyNotingExistence && type == PIID_IPHYSICSOBJECT )
{
// Don't doing the box thing for things like wheels on cars
IPhysicsObject *pPhysObj = (IPhysicsObject *)(*ppPhysObj);
if ( pPhysObj )
{
item.header.modelName = GetModelName( pPhysObj );
item.header.iCollide = physcollision->CollideIndex( pPhysObj->GetCollide() );
if ( item.header.modelName == NULL_STRING )
{
BBox_t *pBBox = GetBBox( pPhysObj );
if ( pBBox != NULL )
{
item.header.bbox = *pBBox;
}
else
{
if ( pPhysObj && pPhysObj->GetSphereRadius() != 0 )
{
item.header.sphere.radius = pPhysObj->GetSphereRadius();
}
else
{
DevMsg( "Don't know how to save model for physics object (class \"%s\")\n", pOwner->GetClassname() );
}
}
}
}
}
m_QueuedSaves.Insert( item );
}
示例2: ComputeVPhysicsSurroundingBox
//-----------------------------------------------------------------------------
// Expand trigger bounds..
//-----------------------------------------------------------------------------
void CCollisionProperty::ComputeVPhysicsSurroundingBox( Vector *pVecWorldMins, Vector *pVecWorldMaxs )
{
bool bSetBounds = false;
IPhysicsObject *pPhysicsObject = GetOuter()->VPhysicsGetObject();
if ( pPhysicsObject )
{
if ( pPhysicsObject->GetCollide() )
{
physcollision->CollideGetAABB( pVecWorldMins, pVecWorldMaxs,
pPhysicsObject->GetCollide(), GetCollisionOrigin(), GetCollisionAngles() );
bSetBounds = true;
}
else if ( pPhysicsObject->GetSphereRadius( ) )
{
float flRadius = pPhysicsObject->GetSphereRadius( );
Vector vecExtents( flRadius, flRadius, flRadius );
VectorSubtract( GetCollisionOrigin(), vecExtents, *pVecWorldMins );
VectorAdd( GetCollisionOrigin(), vecExtents, *pVecWorldMaxs );
bSetBounds = true;
}
}
if ( !bSetBounds )
{
*pVecWorldMins = GetCollisionOrigin();
*pVecWorldMaxs = *pVecWorldMins;
}
// Also, lets expand for the trigger bounds also
if ( IsSolidFlagSet( FSOLID_USE_TRIGGER_BOUNDS ) )
{
Vector vecWorldTriggerMins, vecWorldTriggerMaxs;
WorldSpaceTriggerBounds( &vecWorldTriggerMins, &vecWorldTriggerMaxs );
VectorMin( vecWorldTriggerMins, *pVecWorldMins, *pVecWorldMins );
VectorMax( vecWorldTriggerMaxs, *pVecWorldMaxs, *pVecWorldMaxs );
}
}