本文整理汇总了C++中CASW_Player::EyeVectors方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Player::EyeVectors方法的具体用法?C++ CASW_Player::EyeVectors怎么用?C++ CASW_Player::EyeVectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Player
的用法示例。
在下文中一共展示了CASW_Player::EyeVectors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CC_asw_teleport
void CC_asw_teleport( const CCommand &args )
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if ( !pPlayer )
return;
Vector vTargetPos = pPlayer->GetAbsOrigin();
// fires a command from the console
if ( args.ArgC() < 2 )
{
trace_t tr;
Vector vPlayerForward;
pPlayer->EyeVectors( &vPlayerForward, NULL, NULL );
UTIL_TraceLine( pPlayer->GetAbsOrigin(), pPlayer->GetAbsOrigin() + vPlayerForward * 10000.0f, MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr );
if ( tr.DidHit() )
{
vTargetPos = tr.endpos;
}
}
else
{
// find the named entity
CBaseEntity *target = gEntList.FindEntityByName( NULL, args[1] );
if ( !target )
{
int i = atoi( args[1] );
if ( i != 0 )
{
target = CBaseEntity::Instance( i );
if ( !target )
{
Msg( "Couldn't find entity!\n" );
return;
}
}
else
{
Msg( "Couldn't find entity!\n" );
return;
}
}
vTargetPos = target->GetAbsOrigin();
}
CASW_Marine *pMarine = pPlayer->GetMarine();
if ( !pMarine )
{
for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); ++i )
{
CASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
if ( !pMR )
continue;
if ( pMR->GetMarineEntity() && pMR->GetMarineEntity()->GetCommander() == pPlayer )
{
pMarine = pMR->GetMarineEntity();
break;
}
}
}
if ( pMarine )
{
// Teleport the dude under our control
Vector vecPos = vTargetPos;//pNearest->GetOrigin();
pMarine->Teleport( &vecPos, NULL, NULL );
}
}