本文整理汇总了C++中CBaseEntity::GetAbsAngles方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetAbsAngles方法的具体用法?C++ CBaseEntity::GetAbsAngles怎么用?C++ CBaseEntity::GetAbsAngles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetAbsAngles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNodeYaw
float GetNodeYaw( void )
{
CBaseEntity *pTarget = GetTarget();
if ( pTarget )
{
if ( pTarget->GetAbsAngles().y != 0 )
return pTarget->GetAbsAngles().y;
}
return GetAbsAngles().y;
}
示例2: StartFixedCameraShot
void CHLTVDirector::StartFixedCameraShot(int iCamera, int iTarget)
{
CBaseEntity *pCamera = m_pFixedCameras[iCamera];
Vector vCamPos = pCamera->GetAbsOrigin();
QAngle aViewAngle = pCamera->GetAbsAngles();
m_iPVSEntity = 0; // don't use camera entity, since it may not been transmitted
m_vPVSOrigin = vCamPos;
IGameEvent *shot = gameeventmanager->CreateEvent( "hltv_fixed", true );
if ( shot )
{
shot->SetInt("posx", static_cast<int>(vCamPos.x) );
shot->SetInt("posy", static_cast<int>(vCamPos.y) );
shot->SetInt("posz", static_cast<int>(vCamPos.z) );
shot->SetInt("theta", static_cast<int>(aViewAngle.x) );
shot->SetInt("phi", static_cast<int>(aViewAngle.y) );
shot->SetInt("target", iTarget );
shot->SetFloat("fov", RandomFloat(50,110) );
// send spectators the HLTV director command as a game event
m_pHLTVServer->BroadcastEvent( shot );
gameeventmanager->FreeEvent( shot );
}
}
示例3: TransferChildren
void TransferChildren( CBaseEntity *pOldParent, CBaseEntity *pNewParent )
{
CBaseEntity *pChild = pOldParent->FirstMoveChild();
while ( pChild )
{
// NOTE: Have to do this before the unlink to ensure local coords are valid
Vector vecAbsOrigin = pChild->GetAbsOrigin();
QAngle angAbsRotation = pChild->GetAbsAngles();
Vector vecAbsVelocity = pChild->GetAbsVelocity();
// QAngle vecAbsAngVelocity = pChild->GetAbsAngularVelocity();
UnlinkChild( pOldParent, pChild );
LinkChild( pNewParent, pChild );
// FIXME: This is a hack to guarantee update of the local origin, angles, etc.
pChild->m_vecAbsOrigin.Init( FLT_MAX, FLT_MAX, FLT_MAX );
pChild->m_angAbsRotation.Init( FLT_MAX, FLT_MAX, FLT_MAX );
pChild->m_vecAbsVelocity.Init( FLT_MAX, FLT_MAX, FLT_MAX );
pChild->SetAbsOrigin(vecAbsOrigin);
pChild->SetAbsAngles(angAbsRotation);
pChild->SetAbsVelocity(vecAbsVelocity);
// pChild->SetAbsAngularVelocity(vecAbsAngVelocity);
pChild = pOldParent->FirstMoveChild();
}
}
示例4: UpdateGoal
void COsprey::UpdateGoal( )
{
if (m_pGoalEnt)
{
m_pos1 = m_pos2;
m_ang1 = m_ang2;
m_vel1 = m_vel2;
m_pos2 = m_pGoalEnt->GetAbsOrigin();
m_ang2 = m_pGoalEnt->GetAbsAngles();
UTIL_MakeAimVectors( Vector( 0, m_ang2.y, 0 ) );
m_vel2 = gpGlobals->v_forward * m_pGoalEnt->pev->speed;
m_startTime = m_startTime + m_dTime;
m_dTime = 2.0 * (m_pos1 - m_pos2).Length() / (m_vel1.Length() + m_pGoalEnt->pev->speed);
if (m_ang1.y - m_ang2.y < -180)
{
m_ang1.y += 360;
}
else if (m_ang1.y - m_ang2.y > 180)
{
m_ang1.y -= 360;
}
if (m_pGoalEnt->pev->speed < 400)
m_flIdealtilt = 0;
else
m_flIdealtilt = -90;
}
else
{
ALERT( at_console, "osprey missing target");
}
}
示例5: MapZoneSpawned
bool CMapzoneData::MapZoneSpawned(CMapzone *mZone)
{
bool toReturn = false;
if (!mZone) return false;
char name[128];
if ( !ZoneTypeToClass( mZone->GetType(), name ) ) return false;
CBaseEntity *pEnt = gEntList.FindEntityByClassname(NULL, name);
while (pEnt)
{
if (pEnt->GetAbsOrigin() == *mZone->GetPosition()
&& pEnt->GetAbsAngles() == *mZone->GetRotation()
&& pEnt->WorldAlignMaxs() == *mZone->GetScaleMaxs()
&& pEnt->WorldAlignMins() == *mZone->GetScaleMins())
{
DevLog("Already found a %s spawned on the map! Not spawning it from zone file...\n", name);
toReturn = true;
break;
}
pEnt = gEntList.FindEntityByClassname(pEnt, name);
}
return toReturn;
}
示例6: Activate
//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CPointTeleport::Activate( void )
{
CBaseEntity *pTarget = GetNextTarget();
if (pTarget)
{
if ( pTarget->GetMoveParent() != NULL )
{
Warning("ERROR: (%s) can't teleport object (%s) as it has a parent!\n",GetDebugName(),pTarget->GetDebugName());
return;
}
if (m_spawnflags & SF_TELEPORT_TO_SPAWN_POS)
{
m_vSaveOrigin = pTarget->GetAbsOrigin();
m_vSaveAngles = pTarget->GetAbsAngles();
}
else
{
m_vSaveOrigin = GetAbsOrigin();
m_vSaveAngles = GetAbsAngles();
}
}
else
{
Warning("ERROR: (%s) given no target. Deleting.\n",GetDebugName());
UTIL_Remove(this);
return;
}
BaseClass::Activate();
}
示例7: SpawnEntityAtEntityOriginFromScript
//-----------------------------------------------------------------------------
// Purpose: Spawn an instance of the entity
//-----------------------------------------------------------------------------
void CEnvEntityMaker::SpawnEntityAtEntityOriginFromScript( HSCRIPT hEntity )
{
CBaseEntity *pTargetEntity = ToEnt( hEntity );
if ( pTargetEntity )
{
SpawnEntity( pTargetEntity->GetAbsOrigin(), pTargetEntity->GetAbsAngles() );
}
}
示例8: InputForceSpawnAtEntityOrigin
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CEnvEntityMaker::InputForceSpawnAtEntityOrigin( inputdata_t &inputdata )
{
CBaseEntity *pTargetEntity = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller );
if( pTargetEntity )
{
SpawnEntity( pTargetEntity->GetAbsOrigin(), pTargetEntity->GetAbsAngles() );
}
}
示例9: SpawnEntityAtNamedEntityOriginFromScript
//-----------------------------------------------------------------------------
// Purpose: Spawn an instance of the entity
//-----------------------------------------------------------------------------
void CEnvEntityMaker::SpawnEntityAtNamedEntityOriginFromScript( const char *pszName )
{
CBaseEntity *pTargetEntity = gEntList.FindEntityByName( NULL, pszName, this, NULL, NULL );
if( pTargetEntity )
{
SpawnEntity( pTargetEntity->GetAbsOrigin(), pTargetEntity->GetAbsAngles() );
}
}
示例10: InputSetCameraViewEntity
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CScriptIntro::InputSetCameraViewEntity( inputdata_t &inputdata )
{
// Find the specified entity
string_t iszEntityName = inputdata.value.StringID();
if ( iszEntityName == NULL_STRING )
return;
CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, iszEntityName, NULL, inputdata.pActivator, inputdata.pCaller );
if ( !pEntity )
{
Warning("script_intro %s couldn't find SetCameraViewEntity named %s\n", STRING(GetEntityName()), STRING(iszEntityName) );
return;
}
m_hCameraEntity = pEntity;
m_vecCameraView = pEntity->GetAbsOrigin();
m_vecCameraViewAngles = pEntity->GetAbsAngles();
}
示例11: GetPlayerSpawnSpot
//=========================================================
//=========================================================
edict_t *CGameRules :: GetPlayerSpawnSpot( CBasePlayer *pPlayer )
{
edict_t *pentSpawnSpot = EntSelectSpawnPoint( pPlayer );
CBaseEntity *pSpawnSpot = CBaseEntity::Instance( pentSpawnSpot );
pPlayer->SetAbsOrigin( pSpawnSpot->GetAbsOrigin() + Vector(0,0,1) );
pPlayer->pev->v_angle = g_vecZero;
pPlayer->SetAbsVelocity( g_vecZero );
pPlayer->SetAbsAngles( pSpawnSpot->GetAbsAngles() );
pPlayer->pev->punchangle = g_vecZero;
pPlayer->pev->fixangle = TRUE;
if( pSpawnSpot->pev->spawnflags & 1 ) // the START WITH SUIT flag
{
pPlayer->pev->weapons |= BIT( WEAPON_SUIT );
}
return pentSpawnSpot;
}
示例12: TeleportPlayersToSpawn
void CASW_Arena::TeleportPlayersToSpawn()
{
if ( !ASWGameRules() )
return;
CBaseEntity *pSpot = NULL;
CASW_Game_Resource *pGameResource = ASWGameResource();
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i) != NULL && pGameResource->GetMarineResource(i)->GetMarineEntity())
{
CASW_Marine *pMarine = pGameResource->GetMarineResource(i)->GetMarineEntity();
if ( pMarine->GetHealth() > 0 )
{
pSpot = ASWGameRules()->GetMarineSpawnPoint( pSpot );
if ( pSpot )
{
pMarine->Teleport( &pSpot->GetAbsOrigin(), &pSpot->GetAbsAngles(), &vec3_origin );
}
}
}
}
}
示例13: OnBodyAnimationFinished
void CGstringInteraction::OnBodyAnimationFinished()
{
CDynamicProp *pInteractiveObject = dynamic_cast< CDynamicProp* >( m_hInteractiveObject.Get() );
if ( pInteractiveObject != NULL )
{
pInteractiveObject->ClearInteractionEntity();
}
CGstringPlayer *pPlayer = m_hPlayer;
if ( pPlayer != NULL )
{
pPlayer->EndInteraction();
CBaseEntity *pFinalPosition = m_hFinalPosition;
if ( pFinalPosition != NULL )
{
pPlayer->Teleport( &pFinalPosition->GetAbsOrigin(),
&pFinalPosition->GetAbsAngles(), &vec3_origin );
}
}
m_bInteractionActive = false;
m_InteractionEndEvent.FireOutput( this, this );
}
示例14: Activate
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void CPointTeleport::Activate( void )
{
// Start with our origin point
m_vSaveOrigin = GetAbsOrigin();
m_vSaveAngles = GetAbsAngles();
// Save off the spawn position of the target if instructed to do so
if ( m_spawnflags & SF_TELEPORT_TO_SPAWN_POS )
{
CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, m_target );
if ( pTarget )
{
// If teleport object is in a movement hierarchy, remove it first
if ( EntityMayTeleport( pTarget ) )
{
// Save the points
m_vSaveOrigin = pTarget->GetAbsOrigin();
m_vSaveAngles = pTarget->GetAbsAngles();
}
else
{
Warning("ERROR: (%s) can't teleport object (%s) as it has a parent (%s)!\n",GetDebugName(),pTarget->GetDebugName(),pTarget->GetMoveParent()->GetDebugName());
BaseClass::Activate();
return;
}
}
else
{
Warning("ERROR: (%s) target '%s' not found. Deleting.\n", GetDebugName(), STRING(m_target));
UTIL_Remove( this );
return;
}
}
BaseClass::Activate();
}
示例15: StartTask
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pTask -
//-----------------------------------------------------------------------------
void CAI_OperatorBehavior::StartTask( const Task_t *pTask )
{
switch( pTask->iTask )
{
case TASK_OPERATOR_OPERATE:
{
// Fire the appropriate output!
switch( GetGoalEntity()->GetState() )
{
case OPERATOR_STATE_NOT_READY:
GetGoalEntity()->m_OnMakeReady.FireOutput(NULL, NULL, 0);
break;
case OPERATOR_STATE_READY:
GetGoalEntity()->m_OnBeginOperating.FireOutput(NULL, NULL, 0);
break;
default:
//!!!HACKHACK
Assert(0);
break;
}
}
TaskComplete();
break;
case TASK_OPERATOR_START_PATH:
{
ChainStartTask(TASK_WALK_PATH);
}
break;
case TASK_OPERATOR_GET_PATH_TO_POSITION:
{
CBaseEntity *pGoal = m_hPositionEnt;
if( !pGoal )
{
TaskFail("ai_goal_operator has no location entity\n");
break;
}
AI_NavGoal_t goal( pGoal->GetAbsOrigin() );
goal.pTarget = pGoal;
if ( GetNavigator()->SetGoal( goal ) == false )
{
TaskFail( "Can't build path\n" );
/*
// Try and get as close as possible otherwise
AI_NavGoal_t nearGoal( GOALTYPE_LOCATION_NEAREST_NODE, m_hTargetObject->GetAbsOrigin(), AIN_DEF_ACTIVITY, 256 );
if ( GetNavigator()->SetGoal( nearGoal, AIN_CLEAR_PREVIOUS_STATE ) )
{
//FIXME: HACK! The internal pathfinding is setting this without our consent, so override it!
ClearCondition( COND_TASK_FAILED );
GetNavigator()->SetArrivalDirection( m_hTargetObject->GetAbsAngles() );
TaskComplete();
return;
}
*/
}
GetNavigator()->SetArrivalDirection( pGoal->GetAbsAngles() );
}
break;
default:
BaseClass::StartTask( pTask );
break;
}
}