本文整理汇总了C++中CGib::GetAbsVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ CGib::GetAbsVelocity方法的具体用法?C++ CGib::GetAbsVelocity怎么用?C++ CGib::GetAbsVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGib
的用法示例。
在下文中一共展示了CGib::GetAbsVelocity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnHeadGib
void CGib::SpawnHeadGib( CBaseEntity *pVictim )
{
CGib *pGib = CREATE_ENTITY( CGib, "gib" );
//City17: Germany Violence Fix.
/*if ( g_Language.GetInt() == LANGUAGE_GERMAN )
{
pGib->Spawn( "models/germangibs.mdl" );// throw one head
pGib->m_nBody = 0;
}
else
{*/
pGib->Spawn( "models/gibs/hgibs.mdl" );// throw one head
pGib->m_nBody = 0;
//}
if ( pVictim )
{
Vector vecNewVelocity = pGib->GetAbsVelocity();
pGib->SetLocalOrigin( pVictim->EyePosition() );
edict_t *pentPlayer = UTIL_FindClientInPVS( pGib->edict() );
if ( random->RandomInt ( 0, 100 ) <= 5 && pentPlayer )
{
// 5% chance head will be thrown at player's face.
CBasePlayer *player = (CBasePlayer *)CBaseEntity::Instance( pentPlayer );
if ( player )
{
vecNewVelocity = ( player->EyePosition() ) - pGib->GetAbsOrigin();
VectorNormalize(vecNewVelocity);
vecNewVelocity *= 300;
vecNewVelocity.z += 100;
}
}
else
{
vecNewVelocity = Vector (random->RandomFloat(-100,100), random->RandomFloat(-100,100), random->RandomFloat(200,300));
}
QAngle vecNewAngularVelocity = pGib->GetLocalAngularVelocity();
vecNewAngularVelocity.x = random->RandomFloat ( 100, 200 );
vecNewAngularVelocity.y = random->RandomFloat ( 100, 300 );
pGib->SetLocalAngularVelocity( vecNewAngularVelocity );
// copy owner's blood color
pGib->SetBloodColor( pVictim->BloodColor() );
pGib->AdjustVelocityBasedOnHealth( pVictim->m_iHealth, vecNewVelocity );
pGib->SetAbsVelocity( vecNewVelocity );
}
pGib->LimitVelocity();
}