本文整理汇总了C++中EyeAngles函数的典型用法代码示例。如果您正苦于以下问题:C++ EyeAngles函数的具体用法?C++ EyeAngles怎么用?C++ EyeAngles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EyeAngles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAbsOrigin
void C_CFPlayer::UpdateClientSideAnimation()
{
// Update the animation data. It does the local check here so this works when using
// a third-person camera (and we don't have valid player angles).
if ( this == C_CFPlayer::GetLocalCFPlayer() )
{
if (m_hReviving != NULL || m_hReviver != NULL)
{
C_CFPlayer* pTarget = m_hReviving;
if (!pTarget)
pTarget = m_hReviver;
// Snap the animation to face the model during fatalities.
Vector vecToTarget = pTarget->GetAbsOrigin() - GetAbsOrigin();
QAngle angToTarget;
VectorAngles(vecToTarget, angToTarget);
m_PlayerAnimState->Update( angToTarget[YAW], angToTarget[PITCH] );
}
else
m_PlayerAnimState->Update( EyeAngles()[YAW], EyeAngles()[PITCH] );
}
else
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
BaseClass::UpdateClientSideAnimation();
}
示例2: defined
void CBasePlayer::CalcPlayerView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov )
{
#if defined( CLIENT_DLL )
if ( !prediction->InPrediction() )
{
// FIXME: Move into prediction
view->DriftPitch();
}
#endif
VectorCopy( EyePosition(), eyeOrigin );
#ifdef SIXENSE
if ( g_pSixenseInput->IsEnabled() )
{
VectorCopy( EyeAngles() + GetEyeAngleOffset(), eyeAngles );
}
else
{
VectorCopy( EyeAngles(), eyeAngles );
}
#else
VectorCopy( EyeAngles(), eyeAngles );
#endif
#if defined( CLIENT_DLL )
if ( !prediction->InPrediction() )
#endif
{
SmoothViewOnStairs( eyeOrigin );
}
// Snack off the origin before bob + water offset are applied
Vector vecBaseEyePosition = eyeOrigin;
CalcViewRoll( eyeAngles );
// Apply punch angle
VectorAdd( eyeAngles, m_Local.m_vecPunchAngle, eyeAngles );
#if defined( CLIENT_DLL )
if ( !prediction->InPrediction() )
{
// Shake it up baby!
vieweffects->CalcShake();
vieweffects->ApplyShake( eyeOrigin, eyeAngles, 1.0 );
}
#endif
#if defined( CLIENT_DLL )
// Apply a smoothing offset to smooth out prediction errors.
Vector vSmoothOffset;
GetPredictionErrorSmoothingVector( vSmoothOffset );
eyeOrigin += vSmoothOffset;
m_flObserverChaseDistance = 0.0;
#endif
// calc current FOV
fov = GetFOV();
}
示例3: GetLocalAngles
void C_MSS_Player::PreThink( void )
{
QAngle vTempAngles = GetLocalAngles();
if ( GetLocalPlayer() == this )
{
vTempAngles[PITCH] = EyeAngles()[PITCH];
}
else
{
vTempAngles[PITCH] = m_angEyeAngles[PITCH];
}
if ( vTempAngles[YAW] < 0.0f )
{
vTempAngles[YAW] += 360.0f;
}
SetLocalAngles( vTempAngles );
BaseClass::PreThink();
HandleSpeedChanges();
if ( m_HL2Local.m_flSuitPower <= 0.0f )
{
if( IsSprinting() )
{
StopSprinting();
}
}
}
示例4: GetVehicle
//-----------------------------------------------------------------------------
// Purpose: Returns the eye position and angle vectors.
//-----------------------------------------------------------------------------
void CBasePlayer::EyePositionAndVectors( Vector *pPosition, Vector *pForward,
Vector *pRight, Vector *pUp )
{
#ifdef CLIENT_DLL
IClientVehicle *pVehicle = GetVehicle();
#else
IServerVehicle *pVehicle = GetVehicle();
#endif
if ( pVehicle )
{
Assert( pVehicle );
int nRole = pVehicle->GetPassengerRole( this );
Vector vecEyeOrigin;
QAngle angEyeAngles;
pVehicle->GetVehicleViewPosition( nRole, pPosition, &angEyeAngles );
AngleVectors( angEyeAngles, pForward, pRight, pUp );
}
else
{
VectorCopy( BaseClass::EyePosition(), *pPosition );
AngleVectors( EyeAngles(), pForward, pRight, pUp );
}
}
示例5: IsLocalPlayer
void C_SDKPlayer::LookAtBall(void)
{
const QAngle camAngles = IsLocalPlayer() ? ::input->GetCameraAngles() : m_angCamViewAngles;
float yaw = camAngles[YAW] - EyeAngles()[YAW];
float pitch = camAngles[PITCH];
if (yaw > 180) yaw -= 360;
if (yaw < -180) yaw += 360;
if (pitch > 180) pitch -= 360;
if (pitch < -180) pitch += 360;
//if (yaw > 90) yaw = 180 - yaw;
//if (yaw < -90) yaw = -180 - yaw;
pitch = clamp(pitch, -60, 60);
yaw = clamp(yaw, -120, 120);
float neckVal = clamp(yaw, -50, 50);
SetBoneController(2, neckVal); // Neck
yaw -= neckVal;
float upperSpineVal = clamp(yaw, -40, 40);
SetBoneController(1, upperSpineVal); // Upper spine
yaw -= upperSpineVal;
float lowerSpineVal = clamp(yaw, -30, 30);
SetBoneController(0, lowerSpineVal); // Lower spine
SetBoneController(3, pitch);
}
示例6: AngleVectors
//=========================================================
// Autoaim
// set crosshair position to point to enemey
//=========================================================
Vector C_HL2MP_Player::GetAutoaimVector( float flDelta )
{
// Never autoaim a predicted weapon (for now)
Vector forward;
AngleVectors( EyeAngles() + m_Local.m_vecPunchAngle, &forward );
return forward;
}
示例7: EyeAngles
void C_MSS_Player::PostThink( void )
{
BaseClass::PostThink();
// Store the eye angles pitch so the client can compute its animation state correctly.
m_angEyeAngles = EyeAngles();
}
示例8: ToCFPlayer
void C_CFPlayer::CalcInEyeCamView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov)
{
C_CFPlayer *pTarget = ToCFPlayer(GetObserverTarget());
if ( !pTarget )
{
// just copy a save in-map position
VectorCopy( EyePosition(), eyeOrigin );
VectorCopy( EyeAngles(), eyeAngles );
return;
};
if ( pTarget->ShouldForceThirdPerson() )
{
CalcChaseCamView( eyeOrigin, eyeAngles, fov );
return;
}
fov = GetFOV(); // TODO use tragets FOV
m_flObserverChaseDistance = 0.0;
eyeAngles = pTarget->EyeAngles();
eyeOrigin = pTarget->EyePosition();
// Apply punch angle
VectorAdd( eyeAngles, GetPunchAngle(), eyeAngles );
engine->SetViewAngles( eyeAngles );
}
示例9: ToBasePlayer
/**
Returns true if we are looking towards something within a tolerence determined
by our field of view
*/
bool CBaseCombatCharacter::IsInFieldOfView( CBaseEntity *entity ) const
{
CBasePlayer *pPlayer = ToBasePlayer( const_cast< CBaseCombatCharacter* >( this ) );
float flTolerance = pPlayer ? cos( (float)pPlayer->GetFOV() * 0.5f ) : BCC_DEFAULT_LOOK_TOWARDS_TOLERANCE;
Vector vecForward;
Vector vecEyePosition = EyePosition();
AngleVectors( EyeAngles(), &vecForward );
// FIXME: Use a faster check than this!
// Check 3 spots, or else when standing right next to someone looking at their eyes,
// the angle will be too great to see their center.
Vector vecToTarget = entity->GetAbsOrigin() - vecEyePosition;
vecToTarget.NormalizeInPlace();
if ( DotProduct( vecForward, vecToTarget ) >= flTolerance )
return true;
vecToTarget = entity->WorldSpaceCenter() - vecEyePosition;
vecToTarget.NormalizeInPlace();
if ( DotProduct( vecForward, vecToTarget ) >= flTolerance )
return true;
vecToTarget = entity->EyePosition() - vecEyePosition;
vecToTarget.NormalizeInPlace();
return ( DotProduct( vecForward, vecToTarget ) >= flTolerance );
}
示例10: SetCollisionBounds
void CHL2MP_Player::PostThink( void )
{
BaseClass::PostThink();
if ( GetFlags() & FL_DUCKING )
{
SetCollisionBounds( VEC_CROUCH_TRACE_MIN, VEC_CROUCH_TRACE_MAX );
}
m_PlayerAnimState.Update();
// Store the eye angles pitch so the client can compute its animation state correctly.
m_angEyeAngles = EyeAngles();
QAngle angles = GetLocalAngles();
angles[PITCH] = 0;
SetLocalAngles( angles );
if (!IsDead())
{
if (m_afButtonReleased & IN_KICK && m_flNextKickAttack < gpGlobals->curtime /* && m_flNextKickAttack < gpGlobals->curtime && !m_bIsKicking*/)
{
KickAttack();
m_bIsKicking = true;
}
}
CBaseCombatWeapon *pWeapon = this->GetActiveWeapon();
if (pWeapon != NULL)
{
if (m_afButtonPressed & IN_IRONSIGHT)
{
pWeapon->EnableIronsights();
}
else if (m_afButtonReleased & IN_IRONSIGHT)
{
pWeapon->DisableIronsights();
}
}
if (!IsDead())
{
if (m_flNextKickAttack < gpGlobals->curtime)
{
m_bIsKicking = false;
CBaseViewModel *vm = GetViewModel(1);
if (vm)
{
int idealSequence = vm->SelectWeightedSequence(ACT_VM_IDLE);
if (idealSequence >= 0)
{
vm->SendViewModelMatchingSequence(idealSequence);
}
}
}
}
}
示例11: EyePosition
//-----------------------------------------------------------------------------
// Purpose:
// Input : eyeOrigin -
// eyeAngles -
// zNear -
// zFar -
// fov -
//-----------------------------------------------------------------------------
void CBasePlayer::CalcView( Vector &eyeOrigin, QAngle &eyeAngles, float &zNear, float &zFar, float &fov )
{
eyeOrigin = EyePosition();
eyeAngles = EyeAngles();
#if defined( CLIENT_DLL )
Camera()->CalcView(eyeOrigin, eyeAngles, fov);
#endif
}
示例12: EyeAngles
void C_NEOPlayer::UpdateClientSideAnimation()
{
if ( this == GetLocalNEOPlayer() )
m_PlayerAnimState->Update( EyeAngles()[ YAW ], m_angEyeAngles[ PITCH ] );
else
m_PlayerAnimState->Update( m_angEyeAngles[ YAW ], m_angEyeAngles[ PITCH ] );
C_BaseAnimating::UpdateClientSideAnimation();
}
示例13: EyePosition
/**
Return true if our view direction is pointing at the given target,
within the cosine of the angular tolerance. LINE OF SIGHT IS NOT CHECKED.
*/
bool CBaseCombatCharacter::IsLookingTowards( const Vector &target, float cosTolerance ) const
{
Vector toTarget = target - EyePosition();
toTarget.NormalizeInPlace();
Vector forward;
AngleVectors( EyeAngles(), &forward );
return ( DotProduct( forward, toTarget ) >= cosTolerance );
}
示例14: EyeAngles
void C_SDKPlayer::UpdateClientSideAnimation()
{
// Update the animation data. It does the local check here so this works when using
// a third-person camera (and we don't have valid player angles).
if ( this == C_SDKPlayer::GetLocalSDKPlayer() )
m_PlayerAnimState->Update( EyeAngles()[YAW], m_angEyeAngles[PITCH] );
else
m_PlayerAnimState->Update( m_angEyeAngles[YAW], m_angEyeAngles[PITCH] );
BaseClass::UpdateClientSideAnimation();
}
示例15: DETOUR_DECL_MEMBER
/* CTFBotMvMEngineerIdle::Update static_cast's the owner of the sentry hint
* to a CObjectSentrygun and calls GetTurretAngles, which doesn't exist for
* CObjectDispenser; this tweak should avoid the problem */
DETOUR_DECL_MEMBER(const QAngle&, CObjectDispenser_GetAvailableMetal)
{
TRACE();
if (rc_CTFBotMvMEngineerIdle_Update > 0) {
TRACE_MSG("in CTFBotMvMEngineerIdle::Update");
auto obj = reinterpret_cast<CBaseEntity *>(this);
return obj->EyeAngles();
}
return DETOUR_MEMBER_CALL(CObjectDispenser_GetAvailableMetal)();
}